前台數據
<%Collection coll = (Collection)request.getAttribute("COLExchangeRate");
String pageNo =(String)request.getAttribute("pageNo");
String totalSize =(String)request.getAttribute("totalSize");
String pageSize = (String)request.getAttribute("pageSize");
%>
<DataTable:table dataSrc="<%=coll%>" cssClass="table1"
width="97%" align="center">
<!--放數據-->
</DataTable:table>
<MultiPage:navigator totalSize="<%=totalSize%>" pageSize="<%=pageSize%>" pageNo="<%=pageNo%>" formName="form1" type="text" >
</MultiPage:navigator >
後台傳入數據
String pageSize=request.getParameter("pageSize");
String pageNo=request.getParameter("pageNo");
Collection collExchangeRate = new ArrayList();
if("loadall".equals(policyCode)){
int num=0;
List<Map> tc=new ArrayList<Map>();
tc=TodayContractDelegate.QueryAll();//查數據
num=TodayContractDelegate.QueryAllNum();//查數據條數
request.setAttribute("infoHashMap", tc);
pageNo = request.getParameter("pageNo");
if (StringUtils.isNullOrEmpty(pageNo)){
pageNo = GLCst.PAGE_SIZE_ONE + "";
}
pageSize = "4";
request.setAttribute("totalSize", ""
+ num);
request.setAttribute("pageSize", pageSize);
request.setAttribute("pageNo", pageNo);
collExchangeRate = getExchangeRateList(
tc, Integer.parseInt(pageNo), Integer.parseInt(pageSize));
request.setAttribute("COLExchangeRate", collExchangeRate);
}
private List getExchangeRateList(Collection c,int pageNo,int pageSize){
List resultList = new ArrayList();
if(c instanceof List) {
List list = (List)c;
for(int i = (pageNo-1)*pageSize; i < pageNo*pageSize && i < list.size(); i++){
resultList.add(list.get(i));
}
}
return resultList;
}