📄 docpagniator.java
字号:
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;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class DocPagniator extends Paginator {
HttpServletRequest request;
public DocPagniator(HttpServletRequest request, long total, int pagesize) {
super(request, total, pagesize);
this.request = request;
}
/**
* 生成静态页面的页码
* @param <any> Document
* @return String
*/
public String getHtmlCurPageBlock(Document doc, int curPage) {
this.curPage = curPage;
intpagenum();
if (pagenumbegin == 0)
return "";
String str = "";
if (curpagenumblock > 1) { //如果显示的是第二个页码段的页面
str += "<a title='往前' href=\"" + request.getContextPath() + "/" + doc.getDocHtmlName(pagenumbegin - 1) + "\">" + "<<" + "</a> ";
}
for (int i = pagenumbegin; i <= pagenumend; i++) {
if (i == curPage)
str += i + " ";
else
str += "[<a href=\"" + request.getContextPath() + "/" + doc.getDocHtmlName(i) + "\">" + i +
"</a>] ";
}
if (curpagenumblock < totalpagenumblock) { //如果显示的是第二个页码段的页面
str += "<a title='往后' href=\"" + request.getContextPath() + "/" + 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=" + request.getContextPath() + "/" + doc.getDocHtmlName(k) + ">" + k + "</option>";
else
str += "<option selected value=" + request.getContextPath() + "/" + doc.getDocHtmlName(k) + ">" + k + "</option>";
}
str += "</select> 页";
return str;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -