package com.zoo.pojo;
/**
* @Email 22582416@qq.com
* @author 张如利
* @version 创建时间:2011-4-2上午11:43:01
*/
public class Page {
/** 当前页 */
private int pageNo;
/** 每页数据量 */
private int pageSize;
/** 总数据量 */
private int allCount;
/** 总页数 */
private int allPage;
/** 每页开始 */
private int recordStart;
/** 每页结束 */
private int recordEnd;
/** 是否有上一页 */
private boolean hasPrePage;
/** 是否有下一页 */
private boolean hasNextPage;
/** 显示页数 */
private int showCount;
/** 显示开始 */
private int showStart;
/** 显示结束 */
private int showEnd;
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 getAllCount() {
return allCount;
}
public void setAllCount(int allCount) {
this.allCount = allCount;
}
public int getAllPage() {
return allPage;
}
public void setAllPage(int allPage) {
this.allPage = allPage;
}
public int getRecordStart() {
return recordStart;
}
public void setRecordStart(int recordStart) {
this.recordStart = recordStart;
}
public int getRecordEnd() {
return recordEnd;
}
public void setRecordEnd(int recordEnd) {
this.recordEnd = recordEnd;
}
public boolean isHasPrePage() {
return hasPrePage;
}
public void setHasPrePage(boolean hasPrePage) {
this.hasPrePage = hasPrePage;
}
public boolean isHasNextPage() {
return hasNextPage;
}
public void setHasNextPage(boolean hasNextPage) {
this.hasNextPage = hasNextPage;
}
public int getShowCount() {
return showCount;
}
public void setShowCount(int showCount) {
this.showCount = showCount;
}
public int getShowStart() {
return showStart;
}
public void setShowStart(int showStart) {
this.showStart = showStart;
}
public int getShowEnd() {
return showEnd;
}
public void setShowEnd(int showEnd) {
this.showEnd = showEnd;
}
public Page() {
pageNo = 1;
pageSize = 0;
allPage = 1;
recordStart = 0;
recordEnd = 0;
hasPrePage = false;
hasNextPage = false;
init();
}
public Page(int pageNo, int allCount) {
this.pageNo = pageNo;
this.pageSize = 12;
this.allCount = allCount;
this.showCount = 9 ;
this.allPage = 1;
this.recordStart = 0;
this.recordEnd = 0;
hasPrePage = false;
hasNextPage = false;
init();
}
public Page(int pageNo, int pageSize, int allCount) {
this.pageNo = pageNo;
this.pageSize = pageSize;
this.allCount = allCount;
this.showCount = 9 ;
this.allPage = 1;
this.recordStart = 0;
this.recordEnd = 0;
hasPrePage = false;
hasNextPage = false;
init();
}
public Page(int pageNo, int pageSize, int allCount, int showCount) {
this.pageNo = pageNo;
this.pageSize = pageSize;
this.allCount = allCount;
this.showCount = showCount ;
this.allPage = 1;
this.recordStart = 0;
this.recordEnd = 0;
hasPrePage = false;
hasNextPage = false;
init();
}
public void init() {
allPage = allCount%pageSize==0 ? allCount/pageSize : allCount/pageSize+1 ;
if (pageNo < 1) {
pageNo = 1;
}
if(pageNo>allPage){
pageNo = allPage ;
}
recordStart = (pageNo-1) * pageSize + 1;
recordEnd = Math.min(recordStart+pageSize-1, allCount);
if (pageNo > 1) {
hasPrePage = true;
}
if (pageNo < allPage) {
hasNextPage = true;
}
showCount = Math.min(showCount, allPage);
if (showCount==allPage) {
showStart = 1;
showEnd = showCount;
} else {
if (pageNo <= (showCount+1)/2) {
showStart = 1;
showEnd = showCount ;
} else {
if (pageNo > allPage - showCount/2 ) {
showStart = allPage - showCount + 1 ;
showEnd = allPage ;
} else{
showStart = pageNo - showCount/2;
showEnd = pageNo + showCount/2 ;
}
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Struts2+jsp自定义分页组件以及源码
共34个文件
jar:9个
class:5个
java:5个
4星 · 超过85%的资源 需积分: 9 41 下载量 128 浏览量
2011-04-15
03:24:18
上传
评论
收藏 3.73MB RAR 举报
温馨提示
自已写的一个jsp自定义分页器zoo-paging-1.0.jar,附带有源码以及例子,希望对大家有用!
资源推荐
资源详情
资源评论
收起资源包目录
paging.rar (34个子文件)
paging
.project 1KB
.mymetadata 291B
WebRoot
css
fenye.css 579B
WEB-INF
web.xml 662B
lib
javassist-3.7.ga.jar 531KB
mysql-connector-java-5.1.6-bin.jar 687KB
freemarker-2.3.16.jar 860KB
struts2-core-2.2.1.1.jar 755KB
commons-fileupload-1.2.1.jar 56KB
ognl-3.0.jar 224KB
xwork-core-2.2.1.1.jar 997KB
commons-io-1.3.2.jar 86KB
classes
META-INF
zoo-tags.tld 1011B
com
zoo
web
action
UserAction.class 3KB
tag
ZooPageTag.class 3KB
util
ProReader.class 1KB
pojo
UserInfo.class 1KB
Page.class 4KB
constants.properties 25B
struts.xml 2KB
index.jsp 682B
META-INF
MANIFEST.MF 36B
userlist.jsp 920B
zoo-paging-1.0.jar 5KB
.myeclipse
src
META-INF
zoo-tags.tld 1011B
com
zoo
web
action
UserAction.java 2KB
tag
ZooPageTag.java 3KB
util
ProReader.java 738B
pojo
UserInfo.java 801B
Page.java 4KB
constants.properties 25B
struts.xml 2KB
.fatjar 829B
.classpath 1015B
共 34 条
- 1
feilo
- 粉丝: 3
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页