1 Star 0 Fork 0

yesiaikan/javalearn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
hardPager.java 2.14 KB
一键复制 编辑 原始数据 按行查看 历史
穆礼 提交于 2017-11-09 14:21 . hard ln
package sys.util;
import sys.vo.PageObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;
/**
* Created by zhangxiaolei05 on 2015/8/25.
*/
public class Pager extends TagSupport{
private String path;
private String form;
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getForm() {
return form;
}
public void setForm(String form) {
this.form = form;
}
@Override
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
PageObject pageObject = (PageObject)request.getAttribute("pageObject");
try {
out.println("<script type=\"text/javascript\" src=\"/js/jquery-1.11.3.min.js\"></script>");
out.println("<script type=\"text/javascript\" src=\"/js/jquery.pager.js\"></script>");
out.println("<script type=\"text/javascript\">");
out.println("$(function(){");
out.println("$(\"#pager\").pager({ pagenumber: "+pageObject.getCurrentPage()+", pagecount: "+pageObject.getTotalPage()+", buttonClickCallback: PageClick });");
out.println("});");
out.println("PageClick = function(pageclickednumber) {");
if(null != form && form.length() != 0){
out.println("forward(\"/admin/left/"+path+"/\"+pageclickednumber,'"+form+"');");
}else{
out.println("forward(\"/admin/left/"+path+"/\"+pageclickednumber);");
}
out.println("$(\"#pager\").pager({ pagenumber: pageclickednumber, pagecount: "+pageObject.getTotalPage()+", buttonClickCallback: PageClick });");
out.println("}");
out.println("</script>");
} catch (IOException e) {
e.printStackTrace();
}
return super.doStartTag();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yesiaikan/javalearn.git
git@gitee.com:yesiaikan/javalearn.git
yesiaikan
javalearn
javalearn
master

搜索帮助