jsp调用javabean的问题
ulcer 2003-10-20 05:46:23 我在index.jsp里这么写的
<jsp:useBean id="DBConn" class="DBConn" scope="page" />
不知道我的DBConn.class这个javabean应该放在哪里?现在暂时放在classes里面的
我用的是tomcat5,xp.望高手指点
我的目录:
D:\test
|
+--index.jsp
|
+--WEB-INF\
|
+--web.xml
|
+--classes\
| |
| +--[包名\]*.class
|
+--src\
|
+--[包名\]*.java
提示出错如下:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 15 in the jsp file: /index.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\Tomcat 5.0\work\Catalina\localhost\test\org\apache\jsp\index_jsp.java:57: cannot access org.apache.jsp.DBConn
An error occurred at line: 15 in the jsp file: /index.jsp
Generated servlet error:
bad class file: D:\Tomcat 5.0\work\Catalina\localhost\test\org\apache\jsp\DBConn.class
class file contains wrong class: DBConn
Please remove or make sure it appears in the correct subdirectory of the classpath.
DBConn DBConn = null;
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:128)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:348)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:455)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:300)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.