jsp 无法找到自定义软件包
rg.apache.jasper.
JasperException: Unable to compile class for JSP
Generated servlet error:
E:\Tomcat5.0\work\Catalina\localhost\WEb\org\apache\jsp\ErrorTest\WebRoot\index_jsp.java:7: 软件包 Mty 不存在
import Mty.*;
^
1 错误
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
------解决方案--------------------这个Mty.*;是个jar吗?
手动把它拷贝到tomcat/webinf/lib下
------解决方案--------------------ErrorC dd = new ErrorC(6);这是什么东西??你jsp中导入包了吗?
------解决方案--------------------感谢前面两位回答,貌似我的tomcat没有webapps/appname/和webinf/lib文件夹,不过还好这个问题解决了,但是又有新问题了:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 19 in the jsp file: /ErrorTest/WebRoot/index.jsp
ErrorC
cannot be resolved to a type
16: iThis is my JSP page. <br>
17: </body>
18: <%
19: ErrorC dd = new ErrorC(6);
20: // String ddd = (new Integer(dd.getD())).toString();
21: // out.println(ddd);
22: %>
------解决方案--------------------ErrorC dd = new ErrorC(6);估计这个地方出错了!
------解决方案--------------------没jar 直接手机ctrl+c ctrl+v 贴到tomcat 项目lib下 重新编译试试撒
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.aiyiweb.com/j2ee/2308.html