Page.java
/** * everyPage_size 每页记录数 */public int pageSize = 2;/** * pageIndex 页码 */private int pageIndex = 1;/** * previous_pageIndex 上一页 */@SuppressWarnings("unused")private int prePageIndex;/** * next_pageIndex 下一页 */@SuppressWarnings("unused")private int nextpageIndex;/** * 设置总记录数和每页记录 * @param total * @param pageSize */public Page(int total, int pageSize) {this.total = total;this.pageSize = pageSize;}/** * get_previous_pageIndex * * @return 获得上一页 */public int getPrePageIndex() {return this.pageIndex - 1;}/** * get_next_pageIndex * * @return 获得下一页 */public int getNextpageIndex() {return this.pageIndex + 1;}public Page() {}/** * get_total_pageSize * * @return 获得总页数 */public int getTotalPageSize() {return (int) Math.ceil(this.total / (double) this.pageSize);}/** * if_previous_page 是否有上一页 * * @return */public boolean IsPrePage() {return this.pageIndex > 1 ? true : false;}/** * if_next_page 是否有下一页 * * @return */public boolean IsNextPage() {return this.pageIndex < this.getTotalPageSize() ? true : false;}/** * 得到当前页码 * * @return */public int getPageIndex() {return pageIndex;}/** * 得到总记录数 * * @return */public int getTotal() {return total;}}
Tag.java
mytag.tld
myaction.java
hibernate.java
myJsp.jsp
jsp关键代码
<%@ taglib prefix="mytag" uri="/tld/mytag.tld"%>
<mytag:cutPage action="/sysUser.do?op=toList&index="></mytag:cutPage>
效果图