package com.yidu.utils;
public class PageUtils {
private Integer pageSize;//页面显示记录条数
private Integer rowCount;//总行数
private Integer pageCount;//总页数
private Integer nextPage;//下一页
private Integer prePage;//上一页
private Integer firstPage=1;//第一页
private Integer lastPage;//最后一页
private Integer currentPage;//当前页
private Integer v_satrt;//开始记录数
private Integer v_end;//结束记录数
public PageUtils(Integer rowCount,Integer current,Integer pageSize){
this.pageSize=pageSize;
this.rowCount=rowCount;
this.currentPage=current;
//判断总行数是不是每页显示的倍数
if(rowCount%pageSize==0){
pageCount=rowCount/pageSize;
}else{
//如果不是倍数 总页数加一页
pageCount=rowCount/pageSize+1;
}
//果当前页小于或等于零 将当前页赋值为1
if(currentPage<=0){
currentPage=1;
//如果当关页大于总页数 将总页数赋值为总页数
}else if(currentPage>pageCount){
currentPage=pageCount;
}
//如果当前页大于1并且小于或等于总页数 则上一页可以减1
if(currentPage>1 && currentPage<=pageCount){
prePage=currentPage-1;
//如果当前页刚好等于第一页数 则将上一页数赋值第一页
}else{
prePage=firstPage;
}
//赋值总页数
lastPage=pageCount;
//如果当前页大于0并且小于总页数 则下一页可以加1
if(currentPage>0 && currentPage<pageCount){
nextPage=currentPage+1;
//如果当前页刚好等于总页数 则将总页数赋于下一次
}else{
nextPage=pageCount;
}
v_satrt=(currentPage-1)*pageSize+1;
v_end=currentPage*pageSize;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getRowCount() {
return rowCount;
}
public void setRowCount(Integer rowCount) {
this.rowCount = rowCount;
}
public Integer getPageCount() {
return pageCount;
}
public void setPageCount(Integer pageCount) {
this.pageCount = pageCount;
}
public Integer getNextPage() {
return nextPage;
}
public void setNextPage(Integer nextPage) {
this.nextPage = nextPage;
}
public Integer getPrePage() {
return prePage;
}
public void setPrePage(Integer prePage) {
this.prePage = prePage;
}
public Integer getFirstPage() {
return firstPage;
}
public void setFirstPage(Integer firstPage) {
this.firstPage = firstPage;
}
public Integer getLastPage() {
return lastPage;
}
public void setLastPage(Integer lastPage) {
this.lastPage = lastPage;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getV_satrt() {
return v_satrt;
}
public void setV_satrt(Integer v_satrt) {
this.v_satrt = v_satrt;
}
public Integer getV_end() {
return v_end;
}
public void setV_end(Integer v_end) {
this.v_end = v_end;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ssi.rar (54个子文件)
ssi
a.dmp 4KB
sql.sql 190B
.settings
com.genuitec.eclipse.j2eedt.core.prefs 1KB
org.eclipse.core.resources.prefs 88B
org.eclipse.jdt.core.prefs 629B
src
beans.xml 2KB
SqlMapConfig.xml 596B
jdbc.properties 148B
log4j.properties 2KB
com
yidu
dao
UserDao.java 517B
impl
UserDaoImpl.java 2KB
action
UserAction.java 2KB
model
User.java 634B
User.xml 4KB
service
UserService.java 528B
impl
UserServiceImpl.java 1KB
utils
PageUtils.java 3KB
struts.xml 420B
.project 1KB
WebRoot
META-INF
MANIFEST.MF 39B
WEB-INF
web.xml 1KB
classes
beans.xml 2KB
SqlMapConfig.xml 596B
jdbc.properties 148B
log4j.properties 2KB
com
yidu
dao
UserDao.class 770B
impl
UserDaoImpl.class 4KB
action
UserAction.class 4KB
model
User.class 1KB
User.xml 4KB
service
UserService.class 785B
impl
UserServiceImpl.class 2KB
utils
PageUtils.class 3KB
struts.xml 420B
lib
freemarker-2.3.15.jar 859KB
spring.jar 2.81MB
ojdbc14.jar 1.47MB
ognl-2.7.3.jar 234KB
common-annotations.jar 6KB
commons-logging-1.1.1.jar 59KB
ibatis-2.3.0.677.jar 375KB
aspectjweaver.jar 1.47MB
struts2-spring-plugin-2.1.8.1.jar 16KB
cglib-nodep-2.1_3.jar 317KB
aspectjrt.jar 112KB
commons-pool.jar 61KB
xwork-core-2.1.6.jar 1.49MB
commons-fileupload-1.2.1.jar 56KB
struts2-core-2.1.8.1.jar 738KB
commons-dbcp.jar 119KB
commons-io-1.3.2.jar 86KB
index.jsp 3KB
.mymetadata 298B
.classpath 2KB
.myeclipse
共 54 条
- 1
资源评论
林当时
- 粉丝: 95
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功