大家过来帮我看看
程序代码:
<%@ page contentType="text/html;charset=gbk"%>
<%@ page import="sql.conn" %>
<%@ page import="java.sql.*" %>
<html>
<head>
</head>
<body>
<%
conn conection=new conn();
ResultSet stmt=null;
stmt=conection.Query();
while(stmt.next()){
%>
<%=stmt.getString("bk_id") %>
<%=stmt.getString("bk_name") %>
<%
}
%>
</body>
</html>
以上是jsp中的代码!在我显示这个页面时<%@ page import="sql.conn" %>
<%@ page import="java.sql.*" %>
<html>
<head>
</head>
<body>
<%
conn conection=new conn();
ResultSet stmt=null;
stmt=conection.Query();
while(stmt.next()){
%>
<%=stmt.getString("bk_id") %>
<%=stmt.getString("bk_name") %>
<%
}
%>
</body>
</html>
出现
org.apache.jasper.JasperException: An exception occurred processing JSP page /xx.jsp at line 16
13: ResultSet stmt=null;
14:
15:
16: stmt=conection.Query();
17:
18: while(stmt.next()){
19: %>
请问这个错误该怎么解决! 13: ResultSet stmt=null;
14:
15:
16: stmt=conection.Query();
17:
18: while(stmt.next()){
19: %>
搜索更多相关主题的帖子:
head html
----------------解决方案--------------------------------------------------------
你把代码弄全点啊 尤其是那conn里面的代码
----------------解决方案--------------------------------------------------------
stmt=conection.Query();起的是PreparedStatement中的执行查询语句的作用。、、如果是的话,,,完成没必要这样写啊。。不知你conn是个什么样的类
----------------解决方案--------------------------------------------------------
得先创建个Session吧,LZ这代码是借鉴过来的吧
----------------解决方案--------------------------------------------------------