//前端jquery
$.getJSON("/bigClassServlet",{“action”:“bigQuery”,“currentPage”:1},callback)
function callback(data) {
$.each(data.map, function(i,val){ //i键,val值
$("[name=tbody]").append(
“”+val.id+"" +
“”+val.bigName+"" +
“”+val.bigText+"" +
“修改” +
“删除”
);
});
}
//后端
int currentPage = Integer.parseInt(request.getParameter("currentPage"));
int pageSize = 5;
Map<String, Bigclass> map = new HashMap<>();
map=bigClassService.queryBigcPage(currentPage,pageSize);
PageMap pageMap = new PageMap();
pageMap.setCurrentPage(currentPage);
pageMap.setPageSize(pageSize);
pageMap.setMap(map);
pageMap.setTotalCount(bigClassService.queryBigcCount());
pageMap.setTotalPages(pageMap.getTotalPages());
if (map!=null&&pageMap!=null){
JSONObject bigQueryPageJson = JSONObject.parseObject(JSON.toJSONString(pageMap));
out.print(bigQueryPageJson);
}