日期:2014-05-20 浏览次数:20951 次
//roomBean.java
public Vector list_room(String username){
Vector vc=new Vector();
String sql="select r_number,r_photo,if_book,r_area,r_price,r_facility,insert_time from room_info where username='"+username+"' order by insert_time desc";
try{
this.stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(sql);
while(rs.next())
{ bossBean bos=new bossBean();
bos.setR_number(rs.getString("r_number"));
bos.setR_photo(rs.getString("r_photo"));
bos.setR_area(rs.getString("r_area"));
bos.setR_price(rs.getString("r_price"));
bos.setR_facility(rs.getString("r_facility"));
bos.setInsert_time(rs.getString("insert_time"));
bos.setIf_book(rs.getString("if_book"));
vc.add(bos);
}
}
catch(Exception e)
{e.printStackTrace();}
return vc;
}
//selectList.java
if(request.getParameter("send").equals("list_room")){
username=(String)session.getAttribute("username");
String goToPage = request.getParameter("list_room");
Vector result=db.list_room(username,goToPage);
request.getSession().setAttribute("list_room",(Object)result);
request.getSession().setAttribute("boss_info",null);
request.getSession().setAttribute("search",null);
request.getSession().setAttribute("addroom",null);
request.getSession().setAttribute("upload_success",null);
request.getSession().setAttribute("nullresult",null);
RequestDispatcher rd=request.getRequestDispatcher("trader_index.jsp");
rd.forward(request,response);
}