首页>代码>javabean+servlet+jsp开发商品后台管理系统(源码+数据库脚本)>/JavaWebProject_v1.0/src/com/yueqian/project/bean/PageBean.java
package com.yueqian.project.bean; /** * @ClassName: PageBean * @Description:分页实体类 * 注意:传递的参数只有三个: * totalCount:总条目数 * pageSize:每一页显示的条数 * currentPage:当前页 * 其他:内部计算 * @author: 冯老师 QQ:2506075234 * @date: 2021年3月23日 上午8:31:17 * * @Copyright: 2021 www.gec-edu.org Inc. All rights reserved. * */ public class PageBean { private int totalCount; //总条目数 private int pageSize = 4; //每一页显示的条数 private int totalPage; //总页数 private int currentPage; //当前页面页码 private boolean isFirstPage; //是否首页 private boolean isLastPage; //是否尾页 private int prePage; //回到上一页 private int nextPage; //回到下一页 private int startIndex;//开始索引 private int[] pageCount = new int[5];//动态的页码数量 public PageBean() { super(); } public PageBean(int pageSize, int currentPage,int totalCount) { super(); this.pageSize = pageSize; this.currentPage = currentPage; this.totalCount = totalCount; // 计算总页数 this.totalPage =(totalCount%pageSize==0?0:1)+totalCount/pageSize; // 设置当前索引 this.startIndex = (currentPage-1)*pageSize; // 验证是否是首页 this.isFirstPage = currentPage==1?true:false; // 验证是否是尾页 this.isLastPage = currentPage==totalPage?true:false; // 设置上一页 int currPre = currentPage; this.prePage = isFirstPage?currentPage:--currPre;// 这里不能直接使用currentPage计算,否则会影响到下一页的计算 // 设置下一页 int currNext = currentPage; this.nextPage = isLastPage?currentPage:++currNext; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getTotalPage() { return totalPage; } /** * @Title: setTotalPage * @Description: 设置计算总页数 * @param: totalPage * @return: void */ public void setTotalPage(int totalPage) { this.totalPage =(totalCount%pageSize==0?0:1)+totalCount/pageSize; } public int getCurrentPage() { return currentPage; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public boolean isFirstPage() { return isFirstPage; } /** * @Title: setFirstPage * @Description: 验证是否是首页 * @param: isFirstPage * @return: void */ public void setFirstPage(boolean isFirstPage) { this.isFirstPage = currentPage==1?true:false; } public boolean isLastPage() { return isLastPage; } /** * @Title: setLastPage * @Description: 验证是否是尾页 * @param: isLastPage * @return: void */ public void setLastPage(boolean isLastPage) { this.isLastPage = currentPage==totalPage?true:false; } public int getPrePage() { return prePage; } /** * @Title: setPrePage * @Description: 设置上一页 * @param: prePage * @return: void */ public void setPrePage(int prePage) { this.prePage = isFirstPage?currentPage:--currentPage; } public int getNextPage() { return nextPage; } /** * @Title: setNextPage * @Description: 设置下一页 * @param: nextPage * @return: void */ public void setNextPage(int nextPage) { this.nextPage = isLastPage?currentPage:++currentPage; } public int getStartIndex() { return startIndex; } /** * @Title: setStartIndex * @Description: 设置当前索引 * @param: startIndex * @return: void */ public void setStartIndex(int startIndex) { this.startIndex = (currentPage-1)*pageSize; } }

微信网友_7577830620712960 LV2
7月1日
15532048877 LV1
6月19日
穿山甲1001 LV6
2024年9月7日
TY0165 LV20
2024年6月18日
aholian LV2
2024年6月13日
HangEcho LV2
2024年6月5日
sz1111111 LV2
2024年3月26日
PSSDZH LV3
2024年1月22日
aaasue LV1
2024年1月4日
luoqingyun LV1
2023年12月31日

微信网友_7577830620712960 LV2
7月1日
微信网友_7562058687860736
6月20日
暂无贡献等级
15532048877 LV1
6月19日
blzzza
6月16日
暂无贡献等级
微信网友_7555743612866560
6月15日
暂无贡献等级
wmmmmmm
6月14日
暂无贡献等级
歪比歪比
5月27日
暂无贡献等级
luoyun123
5月11日
暂无贡献等级
wwy000 LV2
4月29日
1138504729
4月13日
暂无贡献等级