急急!!!jsp里JavaBean问题
我写了一个JavaBean,打包语句:package com.wing.javabean;
类名:Bean1
编译完成后把com目录(生成得)复制到WEB-INF/classes/里面,用Dreamweaver运行时出现编译错误,Tomcat提示找不到软件包:com.wing.javabean.Bean1 郁闷之极。。
错误提示如下:
HTTP Status 500 -
--------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /WingTest/testJavaBean.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\Tomcat 5.0\work\Catalina\localhost\J2eeTest\org\apache\jsp\WingTest\testJavaBean_jsp.java:43: 软件包 com.wing.javabean 不存在
com.wing.javabean.Bean1 calculator = null;
^
An error occurred at line: 2 in the jsp file: /WingTest/testJavaBean.jsp
Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\J2eeTest\org\apache\jsp\WingTest\testJavaBean_jsp.java:45: 软件包 com.wing.javabean 不存在
calculator = (com.wing.javabean.Bean1) pageContext.getAttribute( "calculator ", PageContext.REQUEST_SCOPE);
^
An error occurred at line: 2 in the jsp file: /WingTest/testJavaBean.jsp
Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\J2eeTest\org\apache\jsp\WingTest\testJavaBean_jsp.java:47: 软件包 com.wing.javabean 不存在
calculator = new com.wing.javabean.Bean1();
^
3 错误
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
大家能给提提意见吧,拜托~
[解决办法]
目录是这样吗
com\wing\javabean\
Tomcat 重新启动了吗
[解决办法]
检查com\wing\javabean下面有没有Bean1.class这个文件
复制完需要在Tomcat的管理界面里reload,或者重启Tomcat
另外你是不是在jsp页面里引包了? <%@page import= "com.wing.javabean.* "%> ,看看你是不是忘记.*了?
或者你在 <jsp:useBean> 里面是直接写的全限定名是不是只写到com.wing.javabean,后面的.Bean1你写了吗?
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html