黑马程序员技术交流社区
标题:
分页查询
[打印本页]
作者:
heimadragon
时间:
2019-10-24 15:18
标题:
分页查询
String scid = request.getParameter("cid");
String scurrentPage = request.getParameter("currentPage");
String srows = request.getParameter("rows");
String rname = request.getParameter("rname");
//rname=new String(rname.getBytes("iso-8859-1"),"utf-8");
// System.out.println(rname);
// System.out.println(scurrentPage);
int cid=0;
if (scid != null && scid.length()>0){
cid=Integer.parseInt(scid);
}
int currentPage=0;
if (scurrentPage !=null && scurrentPage.length()>0){
currentPage=Integer.parseInt(scurrentPage);
}else {
currentPage=1;
}
int rows=0;
if (srows !=null && srows.length()>0){
rows=Integer.parseInt(srows);
}else {
rows=5;
}
PageBean<Route> pb = rs.findAllByPage(cid, currentPage, rows,rname);
ObjectMapper om=new ObjectMapper();
response.setContentType("application/json;charset=utf-8");
om.writeValue(response.getOutputStream(),pb);
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2