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));
Stringclasscode=(teamInsureList.get(i)).getClasscode();
if(!
FunctionUtils.isBlank(classcode)){
Stringclassname=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");
PrintWriterout=response.getWriter();
Stringjson=jsonArray.toString();
log.info(json);
out.write(json);
out.flush();
out.close();
}catch(Exceptione){
setRequestAttribute("msgInfo","获取团体投保信息失败,请稍后再试");
setRequestAttribute("techInfo","调用交易1216015返回失败");
e.printStackTrace();
log.info(e);
return"error";
}
returnnull;
}
############################################################################################
分页实现方法:
(可以不使用,进攻参考)
packagecom.cpic.hbtx.util;
importjava.util.ArrayList;
importjava.util.List;
importcom.cpic.hbhp.util.Pager;
publicclassPageText{
privateintnowpage=1;//当前页数
privateintpagesize;//每页显示行数
privateintstartrow;//开始分页行数
privateintallnum;//总记录数
privateintpagecount;//总页数
privateStringpath;//链接路径
privateStringpageText;//页面显示
privateListobjlist=newArrayList();//分页对象
publicListgetObjlist(){
returnobjlist;
}
publicvoidsetObjlist(Listobjlist){
this.objlist=objlist;
}
publicPageText(Listlist,Pagerpager,intallnum)throwsException{
//路径
this.path=pager.getPath();
//总记录数
this.allnum=allnum;
//每页显示行数
this.pagesize=pager.getPagesize();
//当前页数
this.nowpage=pager.getPage();
//总页数
this.pagecount=(this.allnum+this.pagesize-1)/this.pagesize;
//开始分页行数
this.startrow=this.nowpage*this.pagesize;
objlist=getList(list,startrow,pagesize,pagecount,nowpage);
getPageText();
}
/**
*分页对象
*/
@SuppressWarnings("unchecked")
publicListgetList(Listlist,intstartrow,intpagesize,intpagecount,intnowpage){
if(pagecount<=nowpage){
for(inti=(startrow-pagesize);ithis.objlist.add(list.get(i));
}
}else{
for(inti=(startrow-pagesize);ithis.objlist.add(list.get(i));
}
}
returnthis.objlist;
}
/**
*页面显示信息
*/
publicStringgetPageText(){
try{
if(this.allnum!
=0){
this.pageText="共【"+this.allnum
+"】条记录 每页显示"
+this.pagesize
+"条记录 共【"
+this.pagecount
+"】页 当前第"
+this.nowpage+"页";
if(this.nowpage<=1){
}else{
this.pageText+="#157DF0\"href=\""
+this.path+1
+"\"title='首页'>[首页] ";
this.pageText+="#157DF0\"href=\""
+this.path+(this.nowpage-1)
+"\"title='上一页'>[上一页] ";
}
if(this.nowpage>=this.pagecount){
}else{
this.pageText+="#157DF0\"href=\""
+this.path+(this.nowpage+1)
+"\"title='下一页'>[下一页] ";
this.pageText+="#157DF0\"href=\""
+this.path+(this.pagecount)
+"\"title='尾页'>[尾页] ";
}
this.pageText+="跳到第";
this.pageText+="functioninPage(){varreg=/^\\d+$/;"
+"varpageno=document.getElementById('pageno').value;"
+"if(!
reg.test(pageno)||parseInt(pageno)<=0){"
+"alert('请输入有效页数');returnfalse;"
+"}elseif(pageno>"
+this.pagecount
+"){alert('输入的页数超过了总页数,请重新输入');returnfalse;}else{window.location.href='"
+this.path
+"'+pageno;returntrue;"
+"}}";
this.pageText+="";
this.pageText+="页inPage();\"/>";
this.pageText+="none;'/>";
}else
this.pageText="未查询到数据!
!
!
";
}catch(Exceptione){
e.printStackTrace();
}
returnthis.pageText;
}
}
############################################################################################
JSP:
<%@pagelanguage="java"pageEncoding="UTF-8"%>
<%@includefile="/view/common/tags.jsp"%>
<%
Stringpath=request.getContextPath();
StringbasePath=request.getScheme()+":
//"
+request.getServerName()+":
"+request.getServerPort()
+path+"/";
%>
">
vartemp=null;
functioninPage(){
vartr="";
varreg=/^\d+$/;
varpageno=parseInt($("#pagenotest").val());
varstartrow=pageno*3;
varpagecount2=parseInt($("#pagecount2").text());
if(!
reg.test(pageno)||parseInt(pageno)<=0){
alert('请输入有效页数');
returnfalse;
}elseif(pageno>pagecount2){
alert('输入的页数超过了总页数,请重新输入');
returnfalse;
}else{
if(pagecount2<=pageno){
for(varj=(startrow-3);jvargappno=temp[j].gappno;
vargpolicyno=temp[j].gpolicyno;
varclasscode=temp[j].classcode;
varclassname=temp[j].classname;
varpolist=temp[j].polist;
varstat=temp[j].stat;
varillamt=temp[j].illamt;
varaccamt=temp[j].accamt;
varsickamt=temp[j].sickamt;
varmedamt=temp[j].medamt;
vartmount=temp[j].tmount;
varsappdate=temp[j].sappdate;
varallnum=temp[j].allnum;
tr=tr+'
'+gappno+ ' | '+gpolicyno+ ' | '+classcode+ ' | '+classname+ ' | '+polist+ ' | '+stat+ ' | '+illamt+ ' | '+accamt+ ' | '+sickamt+ ' | '+medamt+ ' | '+tmount+ ' | '+sappdate+ ' | '+allnum+ ' |
';
}
}else{
for(varj=(startrow-3);jvargappno=temp[j].gappno;
vargpolicyno=temp[j].gpolicyno;
varclasscode=temp[j].classcode;
varclassname=temp[j].classname;
varpolist=temp[j].polist;
varstat=temp[j].stat;
varillamt=temp[j].illamt;
varaccamt=temp[j].accamt;
varsickamt=temp[j].sickamt;
varmedamt=temp[j].medamt;
vartmount=temp[j].tmount;
varsappdate=temp[j].sappdate;
varallnum=temp[j].allnum;
tr=tr+'
'+gappno+ ' | '+gpolicyno+ ' | '+classcode+ ' | '+classname+ ' | '+polist+ ' | '+stat+ ' | '+illamt+ ' | '+accamt+ ' | '+sickamt+ ' | '+medamt+ ' | '+tmount+ ' | '+sappdate+ ' | '+allnum+ ' |
';
}
}
$("#currpage").html(pageno);
$("#test1").html(tr);
}
}
functioninitview(){
showIframe();//初始化页面处理方法
//tab页
vartabID=newArray("team","person");
vartableIDs=newArray("teamTable","personTable");
setTabId(tabID,tableIDs);
}
functions