java web分页查询初试 (六)

2014-11-24 10:24:24 · 作者: · 浏览: 6
) {
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 getRecords() {
return records;
}
public void setRecords(List records) {
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 resultlist;
/** 获得总的记录数 **/
private long totalrecord;

public List getResultlist() {
return resultlist;
}
public void setResultlist(List resultlist) {
this.resultlist = resultlist;
}
public long getTotalrecord() {
return totalrecord;
}
public void setTotalrecord(long totalrecord) {
this.totalrecord = totalrecord;
}
}

/**
* 分页实体类封装
*
*/
public class QueryResult {
/** 获得结果集 **/
private List resultlist;
/** 获得总的记录数 **/
private long totalrecord;

public List getResultlist() {
return resultlist;
}
public void setResultlist(List resultlist) {
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}页

end="${pageView.pageindex.endindex}" var="wp">

第${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}页

end="${pageView.pageindex.endindex}" var="wp">

第${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();
}











bgcolor="#6386d6">











test="null != #request.pageView.records && !#request.pageView.records.isEmpty() ">

onmouseover="this.bgColor = '#DEE7FF';"
onmouseout="this.bgColor='#EFF3F7';">






客户编号 客户名称 联系电话 联系地址 联系人 其他信息 操作
${entity.id } ${entity.name } ${entity.phone } ${entity.email } ${entity.age } ${entity.score } onclick="del('customermanage_del.do customerNO=${entity.id}');">删除