return totalrecord;
}
public void setTotalrecord(long totalrecord) {
this.totalrecord = totalrecord;
setTotalpage(this.totalrecord%this.maxresult==0 this.totalrecord/this.maxresult : this.totalrecord/this.maxresult+1);
}
public List
return records;
}
public void setRecords(List
this.records = records;
}
public PageIndex getPageindex() {
return pageindex;
}
public long getTotalpage() {
return totalpage;
}
public void setTotalpage(long totalpage) {
this.totalpage = totalpage;
this.pageindex = PageIndex.getPageIndex(pagecode, currentpage, totalpage);
}
public int getMaxresult() {
return maxresult;
}
public int getCurrentpage() {
return currentpage;
}
QueryResult.java,数据集
[html]
/**
* 分页实体类封装
*
*/
public class QueryResult
/** 获得结果集 **/
private List
/** 获得总的记录数 **/
private long totalrecord;
public List
return resultlist;
}
public void setResultlist(List
this.resultlist = resultlist;
}
public long getTotalrecord() {
return totalrecord;
}
public void setTotalrecord(long totalrecord) {
this.totalrecord = totalrecord;
}
}
/**
* 分页实体类封装
*
*/
public class QueryResult
/** 获得结果集 **/
private List
/** 获得总的记录数 **/
private long totalrecord;
public List
return resultlist;
}
public void setResultlist(List
this.resultlist = resultlist;
}
public long getTotalrecord() {
return totalrecord;
}
public void setTotalrecord(long totalrecord) {
this.totalrecord = totalrecord;
}
}
分页jsp:
[html]
<%@ page language="java" pageEncoding="GB18030"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
当前页:第${pageView.currentpage}页 |
总记录数:${pageView.totalrecord}条 | 每页显示:${pageView.maxresult}条 |
总页数:${pageView.totalpage}页
第${wp}页
第${wp}页
<%@ page language="java" pageEncoding="GB18030"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
当前页:第${pageView.currentpage}页 |
总记录数:${pageView.totalrecord}条 | 每页显示:${pageView.maxresult}条 |
总页数:${pageView.totalpage}页
第${wp}页
第${wp}页
分页的页面:
[html]
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<script type="text/java script">
//到指定的分页页面
function topage(page) {
var form = document.forms[0];
form.page.value = page;
form.submit();
}