小弟遇到了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里面的“”,要么写成单引号,要么写成\ " 注,后者是转意字符,推荐这么写
------解决方案--------------------
out.println( " <td> <a href= "denglu.jsp "> " +obj[0]+ " </a> </td> " );
晕了。。
其实。。在做论坛的时候。经常会出现要用OUT的情况,我还是新手,不过,我一般会把,不需要的“”都不写,很多量,其实不写“”也会识别的,完全可以这样
out.println( " <td> <a href=denglu.jsp> " +obj[0]+ " </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> " );
[解决办法]
双引号转义
[解决办法]
你可以不使用双引号,或者使用单引号,或者转移。
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html