1 public static CachedRowSetImpl getRowSet(String sql){
2 Connection conn = null;
3 PreparedStatement prep = null;
4 ResultSet rs = null;
5 CachedRowSetImpl rowset = null;
6 try {
7 conn = getConnection();
8 rowset = new CachedRowSetImpl();
9 prep = conn.prepareStatement(sql);
10 rs = prep.executeQuery();
11 rowset.populate(rs);
12 } catch (Exception e) {
13 e.printStackTrace();
14 }finally{
15 close(prep,conn);
16 }
17 return rowset;
18 }
在第8行处new CachedRowSetImpl()用web页面调用该方法时报空指针异常,但是用代码测试时不出现空指针异常,服务器换成tomcat用web页面和代码测试也不出现空指针异常,求大神指点……
添加回答
举报
0/150
提交
取消