日期:2014-05-18  浏览次数:20775 次

小弟遇到了out.println的问题,怎么解决?
//   out.println(   " <td> <a   href= "denglu.jsp "> "   +obj[0]+   " </a> </td> "   );
  //   out.println(   " <td> <a   href= "denglu.jsp "> "   +obj[1]+   " </a> </td> "   );
我想在里面插入一个连接,可是总是报错,这些可以吗?
报错为
org.apache.jasper.JasperException:   Unable   to   compile   class   for   JSP

An   error   occurred   at   line:   19   in   the   jsp   file:   /doJDBC.jsp
Generated   servlet   error:
E:\Report3\work\org\apache\jsp\doJDBC_jsp.java:71:   ') '   expected
            out.println(   " <td> <a   href= "denglu.jsp "> "   +obj[0]+   " </a> </td> "   );
                                                                          ^


An   error   occurred   at   line:   19   in   the   jsp   file:   /doJDBC.jsp
Generated   servlet   error:
E:\Report3\work\org\apache\jsp\doJDBC_jsp.java:72:   ') '   expected
            out.println(   " <td> <a   href= "denglu.jsp "> "   +obj[1]+   " </a> </td> "   );
                                                                          ^
2   errors
提示少一个 ') ',这是什么意思?


------解决方案--------------------
改成
out.println( " <td> <a href= 'denglu.jsp '> " +obj[0]+ " </a> </td> " );
out.println( " <td> <a href= 'denglu.jsp '> " +obj[1]+ " </a> </td> " );

注意字符串 的拼接


------解决方案--------------------
或者
out.println( " <td> <a href=denglu.jsp> " +obj[0]+ " </a> </td> " );
out.println( " <td> <a href=denglu.jsp> " +obj[1]+ " </a> </td> " );
------解决方案--------------------
out.println( " <td> <a href= 'denglu.jsp '> " +obj[0]+ " </a> </td> " );
out.println( " <td> <a href= 'denglu.jsp '> " +obj[1]+ " </a> </td> " );
------解决方案--------------------
out.println( " <td> <a href=\ "denglu.jsp\ "> " +obj[0]+ " </a> </td> " );
out.println( " <td> <a href=\ "denglu.jsp\ "> " +obj[1]+ " </a> </td> " );
------解决方案--------------------
href= 'denglu.jsp '
HTML里面的“”,要么写成单引号,要么写成\ " 注,后者是转意字符,推荐这么写
------解决方案