分页代码

   int rowsize = kcxxManager.searchYcjyCount(keywords, dfl, flmc, qsrq,
    jzrq, sf, cs, jgmc, jgjb);// 得到总记录数
  int totalPage = (rowsize + maxsize - 1) / maxsize;

  int curpage = 1;// 当前页
  if (request.getParameter("curpage") != null
    && !"".equals(request.getParameter("curpage"))) {
   curpage = Integer.parseInt(request.getParameter("curpage"));
  }
  if (curpage < 1) {
   curpage = 1;
  }
  if (curpage > totalPage) {
   curpage = totalPage;
  }

  int start = (curpage - 1) * maxsize;

  List bjxxList = kcxxManager.searchYcjy(start, maxsize, keywords, dfl,
    flmc, qsrq, jzrq, sf, cs, jgmc, jgjb);

  request.setAttribute("rowsize", rowsize);
  request.setAttribute("curpage", curpage);
  request.setAttribute("totalPage", totalPage);

  request.setAttribute("bjxxList", bjxxList);

你可能感兴趣的:(分页)