The code in question is as follows:
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; }
Phenomenon description: This method can be executed to System.out.println("new ArrayList
This is debugged by contacting tomcat in eclipse
Question: Why is there no execution in while? What may be the reason? Thanks! ! !
Isn’t this written correctly?
Try writing it like this