简单实现简单实现jsp分页分页
数据分页,在开发中必不可少,由于数据量太大,不得不进行处理。但是对于分页,又有很多种方式,比如使用sql语句的limit,或
者使用jquery的插件。但是底层的逻辑,都是需要的。
在这里贴出bean对象的代码,以及一个辅助类。我做的这个项目是一个个人博客,算是个人网站吧。
(只贴部分底层逻辑代码)
Page.java
package cn.edu.ldu.util;
public class Page {
private int everyPage; //每页显示的数量
private int totalPage; //总页数
private int totalCount; //总数量
private int currentPage; //当前页
private int beginIndex; //起始页
private boolean hasPrepage; //是否有上一页
private boolean hasNextPage; //是否有下一页
public Page() {
}
public Page(int everyPage, int totalPage, int totalCount, int currentPage,int beginIndex, boolean hasPrepage, boolean
hasNextPage)
{
this.everyPage = everyPage;
this.totalPage = totalPage;
this.totalCount = totalCount;
this.currentPage = currentPage;
this.beginIndex = beginIndex;
this.hasPrepage = hasPrepage;
this.hasNextPage = hasNextPage;
}
public int getEveryPage() {
return everyPage;
}
public void setEveryPage(int everyPage) {
this.everyPage = everyPage;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getBeginIndex() {
return beginIndex;
}
评论0
最新资源