docpagniator.java
来自「cwbbs 云网论坛源码」· Java 代码 · 共 63 行
JAVA
63 行
package cn.js.fan.module.cms.template;import cn.js.fan.db.Paginator;import javax.servlet.http.HttpServletRequest;import cn.js.fan.module.cms.Document;import cn.js.fan.web.Global;public class DocPagniator extends Paginator { HttpServletRequest request; public DocPagniator(HttpServletRequest request, long total, int pagesize) { super(request, total, pagesize); this.request = request; } public String getHtmlCurPageBlock(Document doc, int curPage) { this.curPage = curPage; intpagenum(); if (pagenumbegin == 0) return ""; String str = ""; String rootPath = ""; if (!Global.virtualPath.equals("")) rootPath = "/" + Global.virtualPath; if (curpagenumblock > 1) { str += "<a title='往前' href=\"" + rootPath + "/" + doc.getDocHtmlName(pagenumbegin - 1) + "\">" + "上一页" + "</a> "; } for (int i = pagenumbegin; i <= pagenumend; i++) { if (i == curPage) str += i + " "; else str += "[<a href=\"" + rootPath + "/" + doc.getDocHtmlName(i) + "\">" + i + "</a>] "; } if (curpagenumblock < totalpagenumblock) { str += "<a title='往后' href=\"" + rootPath + "/" + doc.getDocHtmlName(pagenumend + 1) + "\">" + "下一页" + "</a>"; } str += "<script language='javascript'>\n"; str += "<!--\n"; str += "function selpage_onchange()\n"; str += "{\n"; str += "location.href=selpage.value\n"; str += "}\n"; str += "//-->\n"; str += "</script>\n"; str += " 到第 <select name=selpage onchange='selpage_onchange()'>"; for (int k = 1; k <= totalpages; k++) { if (k!=curPage) str += "<option value=" + rootPath + "/" + doc.getDocHtmlName(k) + ">" + k + "</option>"; else str += "<option selected value=" + rootPath + "/" + doc.getDocHtmlName(k) + ">" + k + "</option>"; } str += "</select> 页"; return str; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?