JSP自定义分页标签TAG全过程(3)

/** * 分页基础变量 * * @description * @DATE 2012-3-11下午10:34:00 */ public class SimpleVariable { /** * 显示页码 */ protected int showPageNum = 10; /** * 连接URL */ protected String url = null; /** * 当前页码 */ protected int pageNo = 1; /** * 总页码 */ protected int totalPage = 1; /** * 总条数 */ protected int totalSum = 0; /** * 每页显示条数 */ protected int pageSize = 10; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public int getTotalPage() { return totalPage; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public int getTotalSum() { return totalSum; } public void setTotalSum(int totalSum) { this.totalSum = totalSum; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getShowPageNum() { return showPageNum; } public void setShowPageNum(int showPageNum) { this.showPageNum = showPageNum; } public int getPageNo() { return pageNo; } public void setPageNo(int pageNo) { this.pageNo = pageNo; } }

/** * 分页变量 * * @description * @DATE 2012-3-11下午10:34:08 */ public class VariablePage extends SimpleVariable { protected String split = " "; protected String style = "class='page'"; public VariablePage(int pageNo, int totalSum, int pageSize, String url) { pageNo = pageNo < 1 ? 1 : pageNo; super.pageNo = pageNo; this.totalSum = totalSum; this.url = url; this.pageSize = pageSize; } public VariablePage(int pageNum, int totalSum, String url) { pageNum = pageNum < 1 ? 1 : pageNum; super.pageNo = pageNum; this.totalSum = totalSum; this.url = url; } public String getSplit() { return split; } public void setSplit(String split) { this.split = split; } }

#需要使用该分页标签的JSP 使用方法如下:

JSP 头部引入

<%@taglib uri="http://www.kevin.com/taglibs/page" prefix="page" %>

使用以下标签生成分页HTML代码

<page:htmlPage pageNo="${pageNo}" url="your_url" totalSum="${totalSum}" showPage="10" pageSize="12"/>

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzfzxz.html