急求JSP分页的例子

来源:百度知道 编辑:UC知道 时间:2024/05/21 06:40:18
我从数据库把数据都取出来了,现在怎么分页啊,那位大虾给我个例子参考一下啊,谢谢,我也知道这样做不好,会造成性能问题,但现在就这个状况了,只能呢个讲错就错了

action:
查询按钮:public ActionForward search(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

HttpSession session = request.getSession();
session.removeAttribute("pb");
session.removeAttribute("totalRows");
session.removeAttribute("map");

UserForm frm = (UserForm) form;
String user_id = frm.getUser_id();
String username = frm.getUsername();

MyMap map = new MyMap();
map.put("user_id", user_id);
map.setLike("username", username);
session.setAttribute("map", map);

DB db = new DB();
int totalRows = db.getRows("user.rows", map);
session.setAttribute("totalRows", totalRows);

PageBean pb = new PageBean(totalRows);

pb = new PageBean(totalRows);
int pageRecorders = pb.getPageRecorders();
List list = db.selectpar