当前页面: 开发资料首页 → JSP 专题 → jsp调用javabean连接数据库的问题?
jsp调用javabean连接数据库的问题?
摘要: jsp调用javabean连接数据库的问题?
JSP中的代码如下:
<%
ResultSet rst=connBean.execute("select * from tbl_User");
%>
此时一切正常,
但当我把bean中的execute(String str)方法“改名”为executeSQL(String str)
同时JSP代码中也改为如下:
<%
ResultSet rst=connBean.executeSQL("select * from tbl_User");
%>
但将会报错如下:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 10 in the jsp file: /ConnDB.jsp
Generated servlet error:
The method executeSQL(String) is undefined for the type ConnDB(可我确实定义了啊)
我找到一个极为蠢的方法!
我把它复制一些并换了个文件名(原文件夹名为test,复制后改为test2)结果就正确了!
这是为什么啊!
谢谢
请大家帮忙!,谢谢!
%TOMCAT_HOME/work/Catalina/localhost/test/org/apache/jsp文件夹下把ConnDB_jsp.jsp,ConnDB_jsp.class删掉