有问题段的代码如下:
public ArrayList
ArrayList list=null;
try {
String sql="select * from menu where misEnable=1";
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(sql);
System.out.println("rs:"+rs);
menuentity m=null;
list=new ArrayList();
System.out.println("new ArrayList();");
while(rs.next()){
System.out.println("rs.next()");
m=new menuentity();
m.setMid(rs.getString(1));
m.setMname(rs.getString(2));
m.setMurl(rs.getString(3));
m.setMimg(rs.getString(4));
m.setMparnetid(rs.getString(5));
m.setMcreatedate(rs.getDate(6));
m.setMisEnable(rs.getInt(7));
m.setMcreater(rs.getString(8));
m.setMisLeaf(rs.getInt(9));
System.out.println("1:"+rs.getString(1));
list.add(m);
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("1daolist:"+list);
return list;
}
现象描述:这个方法中能执行到System.out.println("new ArrayList
这是在eclipse中和tomcat联系调试的
问题:为什么while里面没有执行,可能是什么原因?谢谢!!!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这个写的不对吧
写成这个试试