日期:2014-05-20 浏览次数:20636 次
rs=stmt.executeQuery(sql);
List<UseBeanInfo> list=new ArrayList<UseBeanInfo>();
while(rs.next())
{
UseBeanInfo usi=new UseBeanInfo();
usi.setId(rs.getInt("id"));
usi.setStatus(rs.getInt("status"));
usi.setName(rs.getString("name"));
usi.setAddress(rs.getString("address"));
usi.setMobile(rs.getString("mobile"));
list.add(usi);
}
RequestDispatcher rd = req.getRequestDispatcher("/welcome.jsp");
req.setAttribute("list",list);//存值
rd.forward(req,resp);
List list=(ArrayList)request.getAttribute("list")
UseBeanInfo usi=new UseBeanInfo();
usi.getString("name");
List<UseBeanInfo> list=(ArrayList)request.getAttribute("list");
for(UseBeanInfo usi : list){
String name = usi.getString("name");
System.out.println(name);
}