日期:2014-05-18  浏览次数:20595 次

jsp的createStatement()出问题,一直没法解决
org.apache.jasper.JasperException:   Exception   in   JSP:   /test.jsp:7

4:   <%
5:   DBConnection   DBConn   =   new   DBConnection();
6:   Connection   Conn   =   DBConn.getConn();
7:           Statement   stmt   =   Conn.createStatement();
8:           //String   sql   =   "select   *   from   BigClass   order   by   BigClassID ";
9:           //ResultSet   rs   =   stmt.executeQuery(sql);
10:   %>

只要把第七句注释了,就正常;加上马上就是这么个反应。
什么问题?

------解决方案--------------------
Conn这个是不是null啊

------解决方案--------------------
加个异常处理看看: <%
try{
5: DBConnection DBConn = new DBConnection();
6: Connection Conn = DBConn.getConn();
7: Statement stmt = Conn.createStatement();
8: //String sql = "select * from BigClass order by BigClassID ";
9: //ResultSet rs = stmt.executeQuery(sql);
}catch(Exception ex){
ex.printstacktrace();}
10: %>