package com.demo.struts2.util;
import java.util.ArrayList;
import java.util.List;
public class Pager {
// 页面大小
protected int[] pageSizeList = { 10, 25, 50, 100, 200, 300, 500 };
// 一页显示的记录数
protected int pageSize = Constants.pageSize;
// 当前页码
protected int pageNo = Constants.pageNo;
// 记录总数
protected int rowCount = 0;
// 总页数
protected int pageCount = 1;
// 起始行数
protected int startIndex = 1;
// 结束行数
protected int endIndex = 1;
protected int firstPageNo = 1;
protected int prePageNo = 1;
protected int nextPageNo = 1;
protected int lastPageNo = 1;
// 结果集存放List
protected List resultList;
public Pager(int pageSize, int pageNo, int rowCount, List resultList) {
this.pageSize = pageSize;
this.pageNo = pageNo;
this.rowCount = rowCount;
this.resultList = resultList;
if (rowCount % pageSize == 0) {
this.pageCount = rowCount / pageSize;
} else {
this.pageCount = rowCount / pageSize + 1;
}
this.startIndex = pageSize * (pageNo - 1);
this.endIndex = this.startIndex + resultList.size();
this.lastPageNo = this.pageCount;
if (this.pageNo > 1) this.prePageNo = this.pageNo -1;
if (this.pageNo == this.lastPageNo){
this.nextPageNo = this.lastPageNo;
} else {
this.nextPageNo = this.pageNo + 1;
}
}
public Object[] getPageSizeIndexs() {
List result = new ArrayList(pageSizeList.length);
for (int i = 0; i < pageSizeList.length; i++) {
result.add(String.valueOf(pageSizeList[i]));
}
Object[] indexs = (result.toArray());
return indexs;
}
public Object[] getPageNoIndexs() {
List result = new ArrayList(pageCount);
for (int i = 0; i < pageCount; i++) {
result.add(String.valueOf(i + 1));
}
Object[] indexs = (result.toArray());
return indexs;
}
public int getEndIndex() {
return endIndex;
}
public void setEndIndex(int endIndex) {
this.endIndex = endIndex;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int[] getPageSizeList() {
return pageSizeList;
}
public void setPageSizeList(int[] pageSizeList) {
this.pageSizeList = pageSizeList;
}
public List getResultList() {
return resultList;
}
public void setResultList(List resultList) {
this.resultList = resultList;
}
public int getRowCount() {
return rowCount;
}
public void setRowCount(int rowCount) {
this.rowCount = rowCount;
}
public int getStartIndex() {
return startIndex;
}
public void setStartIndex(int startIndex) {
this.startIndex = startIndex;
}
public int getFirstPageNo() {
return firstPageNo;
}
public void setFirstPageNo(int firstPageNo) {
this.firstPageNo = firstPageNo;
}
public int getLastPageNo() {
return lastPageNo;
}
public void setLastPageNo(int lastPageNo) {
this.lastPageNo = lastPageNo;
}
public int getNextPageNo() {
return nextPageNo;
}
public void setNextPageNo(int nextPageNo) {
this.nextPageNo = nextPageNo;
}
public int getPrePageNo() {
return prePageNo;
}
public void setPrePageNo(int prePageNo) {
this.prePageNo = prePageNo;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于struts2+hibernate3+spring的分页组件
共96个文件
jar:25个
properties:16个
java:12个
5星 · 超过95%的资源 需积分: 9 128 下载量 114 浏览量
2008-09-18
09:37:06
上传
评论 2
收藏 9.73MB RAR 举报
温馨提示
基于struts2+hibernate3+spring的分页组件
资源推荐
资源详情
资源评论
收起资源包目录
ssh2page.rar (96个子文件)
ssh2page
src
commons-logging.properties 198B
log4j.properties 978B
com
demo
dao
IBookDao.java 60B
impl
BookDaoImpl.java 264B
base
hibernate
dao
BaseHibernateDao.java 2KB
GenericsUtils.java 2KB
test
Sql.java 293B
Test.java 592B
vo
Book.hbm.xml 624B
Book.java 447B
struts2
resources
ApplicationResources.properties 8KB
ApplicationResources_en.properties 8KB
ApplicationResources_zh_CN.properties 12KB
ApplicationResources_temp.properties 8KB
common
BaseAction.java 2KB
PageAction.java 730B
actions
BookAction.java 1KB
util
Constants.java 1016B
Pager.java 3KB
struts.xml 405B
struts.properties 8KB
simplelog.properties 60B
template
simple
actionmessage.ftl 168B
actionerror.ftl 155B
fielderror.ftl 1KB
数据库创建脚本.sql 125B
.project 1KB
WebRoot
list.jsp 2KB
images
logo3.png 2KB
logo6.bmp 4KB
logo7.bmp 4KB
logo2.png 23KB
logo5.bmp 4KB
Thumbs.db 15KB
logo8.bmp 4KB
logo4.png 20KB
address.jsp 3KB
META-INF
MANIFEST.MF 39B
WEB-INF
web.xml 2KB
classes
commons-logging.properties 198B
log4j.properties 978B
com
demo
dao
IBookDao.class 110B
impl
BookDaoImpl.class 463B
base
hibernate
dao
GenericsUtils.class 2KB
BaseHibernateDao.class 3KB
test
Test.class 1KB
Sql.class 865B
vo
Book.hbm.xml 624B
Book.class 889B
struts2
resources
ApplicationResources.properties 8KB
ApplicationResources_en.properties 8KB
ApplicationResources_zh_CN.properties 12KB
ApplicationResources_temp.properties 8KB
common
PageAction.class 1KB
BaseAction.class 2KB
actions
BookAction.class 2KB
util
Constants.class 1017B
Pager.class 4KB
struts.xml 405B
struts.properties 8KB
simplelog.properties 60B
applicationContext.xml 2KB
template
simple
actionmessage.ftl 168B
actionerror.ftl 155B
fielderror.ftl 1KB
lib
commons-collections-3.1.jar 546KB
oro-2.0.8.jar 64KB
commons-logging-1.0.4.jar 37KB
spring.jar 2.57MB
jta.jar 9KB
commons-validator-1.3.0.jar 117KB
log4j-1.2.12.jar 350KB
xwork-2.0.4.jar 445KB
commons-beanutils-1.6.jar 116KB
ehcache-1.1.jar 46KB
mysql-connector-java-5.0.4-bin.jar 484KB
struts2-core-2.0.9.jar 2.1MB
ognl-2.6.11.jar 164KB
cglib-nodep-2.1_2.jar 317KB
sitemesh-2.3.jar 178KB
commons-chain-1.1.jar 88KB
commons-logging.jar 37KB
struts2-spring-plugin-2.0.9.jar 8KB
commons-pool-1.2.jar 41KB
commons-logging-api-1.1.jar 44KB
antlr-2.7.2.jar 350KB
commons-dbcp.jar 105KB
freemarker-2.3.8.jar 784KB
dom4j-1.6.jar 306KB
hibernate3.jar 1.6MB
applicationContext.xml 2KB
page.jsp 2KB
styles.css 603B
index.jsp 848B
.mymetadata 297B
.classpath 2KB
.myeclipse
共 96 条
- 1
资源评论
- 廿指緊釦2013-11-21能跑起来,但可惜无借鉴意义
michaelxz
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于python实现的多线程爬虫爬取电影天堂资源
- 基于MFC的教职工信息管理系统c++源码含代码注释.zip
- 毕业设计-基于Vue + Node的外卖系统设计与实现
- python烟花代码示例
- 中国各地级市工业三废数据(2006-2021年).xlsx
- 基于MFC的校园导航程序(使用最短路径dijkstra算法).rar
- Android Studio android APP 视频作为视图背景需要源代码或想了解其实现原理的可以私心我
- com.ZeroneGames.GreenProject.apk
- Python自动化开发入门教程
- 4399GameSem_116_13955_207551_6.apk
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功