- /**
- * 用于分页显示的bean类
- * @author xuhai
- *
- */
- public class Page {
- private int pageNum; //当前页
- private int pageSize; //每页显示数
- private int noteCount; //总记录数
- private int pageCount; //总页数
- private int beginIndex; //每页开始索引
- private int endIndex; //每页结束索引
- private int lastPage; //上一页
- private int nextPage; //下一页
- public Page() {}
- public Page(int pNum, int pSize, int count){
- pageNum = pNum<1 ? 1 : pNum;
- pageSize = pSize;
- noteCount = count;
- pageCount = (noteCount + pageSize - 1)/pageSize;
- if(pageNum > pageCount && pageCount != 0)
- pageNum = pageCount;
- lastPage = pageNum-1; // 0 表示没有上一页
- nextPage = pageNum < pageCount ? (pageNum+1) : 0; // 0 表示没有下一页
- beginIndex = (pageNum-1)*pageSize+1;
- int end = pageNum*pageSize;
- endIndex = end < noteCount ? end : noteCount;
- }
- //pageSize 设为固定值
- public Page(int pNum, int count){
- this(pNum, 5, count);
- }
- public int getPageNum() {
- return pageNum;
- }
- public void setPageNum(int pageNum) {
- this.pageNum = pageNum;
- }
- public int getPageSize() {
- return pageSize;
- }
- public void setPageSize(int pageSize) {
- this.pageSize = pageSize;
- }
- public int getPageCount() {
- return pageCount;
- }
- public void setPageCount(int pageCount) {
- this.pageCount = pageCount;
- }
- public int getNoteCount() {
- return noteCount;
- }
- public void setNoteCount(int noteCount) {
- this.noteCount = noteCount;
- }
- public int getBeginIndex() {
- return beginIndex;
- }
- public void setBeginIndex(int beginIndex) {
- this.beginIndex = beginIndex;
- }
- public int getEndIndex() {
- return endIndex;
- }
- public void setEndIndex(int endIndex) {
- this.endIndex = endIndex;
- }
- public int getLastPage() {
- return lastPage;
- }
- public void setLastPage(int lastPage) {
- this.lastPage = lastPage;
- }
- public int getNextPage() {
- return nextPage;
- }
- public void setNextPage(int nextPage) {
- this.nextPage = nextPage;
- }
- }
struts 分页的pageBean
最新推荐文章于 2020-09-15 15:04:27 发布