方法名 | 解释 |
---|---|
getPages() | 总页数 |
getPageNum() | 当前页码 |
getTotal() | 内容条目数 |
通常使用:
Integer pageNo = 1;
Integer pageSize = 10;
try {
pageNo = Integer.parseInt(Const.getPara(req, "page_no"));
} catch (Exception ex) {
}
try {
pageSize = Integer.parseInt(Const.getPara(req, "page_size"));
} catch (Exception ex) {
}
.......
PageInfo<Comment> page = new PageInfo<Comment>(comments);
if (pageNo > page.getLastPage()) {
// pageno超过最大值
return ResJson.getSucJson(ResJson.FAILD_NULL_CODE, ResJson.NOMORE_DATA_TEXT, maps);
}
for (int i = 0; i < comments.size(); i++) {
maps.add(comment2MapWithReply(comments.get(i)));
}
return ResJson.getSucJson(ResJson.SUCCESS_CODE, ResJson.SUCCESS_CODE_TEXT, maps, pageNo + "",
page.getPages() + "", page.getTotal() + "");