好像使用这个方法并没有简单,而更复杂了。。。
public List<Student> getAllStus()
{
List<Student> stuList=new ArrayList<Student>();
Connection conn=DButil.getDbConn();
String sql="select * from stu_info";
QueryRunner qr=new QueryRunner();
tyr{
qr.execute(conn,sql,new ResultSetHandler(){
public List<Student> handle(final ResultSet rs){
final List<Student> stuList=new ArrayList<Student>();
try{
while(rs.next()){
stuList.add(new Student(类Student 的所有属性));
}
}catch(final SQLException e){
e.printStackTrace();
}
return stuList;
}//handle方法结束
}//匿名内部类结束,nulll);
}//外层try 结束
}//getAllStus