后台实现JSON分页显示
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Action:
/**
* 团单明细--团体投保信息
*/
public String teamInsure() {
//String grpcode = getRequestParameter("grpcode"); // 团体代码
String grpcode = "CHS000G01944";
("grpcode:"+grpcode+"团体投保信息---");
List
Pager pager = getPager("classDetailInfo/classDetailInfo_teamInsure.do?page=");
pager.setPagesize(3);
PageText pageText = null;
try {
teamInsureList = classDetailInfoServices.getTeamInsure(grpcode);
pageText = classDetailInfoServices.getPageText(teamInsureList, pager, teamInsureList.size());
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
for (int i = 0; i < teamInsureList.size(); i++) {
jsonObject.element("gappno", (teamInsureList.get(i)).getGappno());
jsonObject.element("gpolicyno", (teamInsureList.get(i)).getGpolicyno());
jsonObject.element("classcode", (teamInsureList.get(i)).getClasscode());
jsonObject.element("size", (teamInsureList.size()));
jsonObject.element("pagecount", ((teamInsureList.size() + 2) / 3));
String classcode = (teamInsureList.get(i)).getClasscode();
if (!FunctionUtils.isBlank(classcode)) {
String classname = classDetailInfoServices.getClassname(classcode); // 险种名称
jsonObject.element("classname", classname);
}else {
jsonObject.element("classname", "");
}
jsonObject.element("polist", (teamInsureList.get(i)).getPolist());
jsonObject.element("stat", (teamInsureList.get(i)).getStat());
jsonObject.element("sumamt", (teamInsureList.get(i)).getSumamt());
jsonObject.element("illamt", (teamInsureList.get(i)).getIllamt());
jsonObject.element("accamt", (teamInsureList.get(i)).getAccamt());
jsonObject.element("sickamt", (teamInsureList.get(i)).getSickamt());
jsonObject.element("medamt", (teamInsureList.get(i)).getMedamt());
jsonObject.element("tmount", (teamInsureList.get(i)).getTmount());
jsonObject.element("sappdate", (teamInsureList.get(i)).getSappdate());
jsonObject.element("allnum", (teamInsureList.get(i)).getAllnum());
jsonObject.element("size", (teamInsureList.size()));
jsonObject.element("pagecount", ((teamInsureList.size() + 2) / 3));
jsonArray.add(jsonObject);
}
response.setContentType("text/html");
response.setCharacterEncoding("GB2312");
PrintWriter out = response.getWriter();
String json = jsonArray.toString();
(json);
out.write(json);
out.flush();
out.close();
} catch (Exception e) {
setRequestAttribute("msgInfo", "获取团体投保信息失败,请稍后再试");
setRequestAttribute("techInfo", "调用交易1216015返回失败");
e.printStackTrace();
(e);
return "error";
}
return null;
}
############################################################################### ####################
分页实现方法:
package com.cpic.hbtx.util;
import java.util.ArrayList;
import java.util.List;
import com.cpic.hbhp.util.Pager;
public class PageText {
private int nowpage = 1; // 当前页数
private int pagesize; // 每页显示行数
private int startrow; // 开始分页行数
private int allnum; // 总记录数
private int pagecount; // 总页数
private String path; // 链接路径