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

jsp页面出错,帮忙分析一下!惨惨。帮帮新手啊.谢谢
页面调试出现如下错误。DispUsers是bean中一个类/其他用到的类也出现一样的错误
org.apache.jasper.JasperException:   Unable   to   compile   class   for   JSP:  

An   error   occurred   at   line:   4   in   the   jsp   file:   /login.jsp
DispUsers   cannot   be   resolved   to   a   type
1:   <%@   page   contentType= "text/html;charset=gb2312 "   %>
2:   <%request.setCharacterEncoding( "gb2312 ");%>    
3:   <%@   include   file= "incdb.jsp "%>
4:   <%
5:   String   post=request.getParameter( "POST ");)
6:   String   action= "True ";
7:   if(post!=null&&post.equals(action))
各位帮帮忙吧。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

------解决方案--------------------
java.home指到$JAVA_HOME/jre下了.
其lib下的tools.jar跟$JAVA_HOME/lib/tools.jar不一样,
编译jsp的时候需要用到后者.
应此需要在启动tomcat的时候让jvm知道tools.jar的位置就可以了.

注: java.home在运行的时候就会指向$JRE_HOME.
jdk 1.4.2_06-b03
jdk 1.5.0_05-b05
都会出现这种情况.

修改例子:
ant:
增加
<property environment= "env " />
然后在启动tomcat的时候把 <pathelement location= "${java.home}/lib/tools.jar " />
改为: <pathelement location= "${env.JAVA_HOME}/lib/tools.jar " />
就可以了.

eclipse:
windows -> preference -> tomcat -> jvm settings -> boot classpath 中加入你的
JAVA_HOME/lib/tools.jar就可以了.

我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.aiyiweb.com/j2ee/2308.html