package com.wepull.mytag;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
public class PaginateTag extends TagSupport{
/**
*
*/
private static final long serialVersionUID = -5649855178067051902L;
private String action;//
private String firstResult;
private String maxSize;//页最大行数
private String total;//结果集的总条数数
private String otherParam;//其他需要加在url后面的参数
@Override
public int doEndTag() throws JspException {
action = action+"?";
int _firstResult = (firstResult==null||firstResult=="")?0:Integer.parseInt(this.firstResult);
int _maxSize = Integer.parseInt(this.maxSize);//格式化成数字
int _total = Integer.parseInt(this.total);//格式化成数字
otherParam = (otherParam!=null)?otherParam:"";
int num = _total % _maxSize ==0?_total / _maxSize:(_total / _maxSize)+1;
String tempstring = "";
String casestring = "<a style='display:none' id='forPaginate' href="+action + "firstResult=0&maxSize=" +_maxSize+ "&"+ otherParam +" > "+ "临时" +"</a>";
tempstring = (_firstResult > 0)? casestring+"<span> <a id='forPaginate' href="+action + "firstResult=" +(_firstResult-_maxSize)+ "&maxSize=" +_maxSize+ "&"+ otherParam +" > "+ "上一页" +"</a> </span>" : ""+casestring;
for(int i=((_firstResult/_maxSize)-10)<0?0:((_firstResult/_maxSize)-10);i<((_firstResult/_maxSize)+10)&&i<num;i++){
//限制最大链接数
if(_firstResult >=i*_maxSize && _firstResult< (i+1)*_maxSize ){
casestring = String.valueOf(i+1);
}else{
casestring = "<span> <a name='forPaginate' id='forPaginate' href="+action + "firstResult=" +i*_maxSize+ "&maxSize=" +_maxSize+ "&"+ otherParam +" > "+ (i+1) +"</a> </span>";
}
tempstring = tempstring+casestring;
}
casestring = ((_firstResult+_maxSize) < _total)? "<span> <a id='forPaginate' href="+action + "firstResult=" +(_firstResult+_maxSize)+ "&maxSize=" +_maxSize+ "&"+ otherParam +" > "+ "下一页" +"</a> </span>":"";
tempstring = tempstring+casestring;
//手动输入跳转
tempstring = tempstring +" <span><input type='text' id='page_num' name='page_num' size='5' maxlength='5' value='"+((_firstResult/_maxSize)+1)+"' /> /" +num + "</span> <INPUT type='hidden' id=maxSize value="+_maxSize+" name=maxSize> <span><input type='button' value='GO' onclick='addPageUrl()'/></span>";
JspWriter out = pageContext.getOut();//获得一个输出对象
try {
tempstring = tempstring +"<script>function addPageUrl(){this.location = document.getElementsByName('forPaginate')[0].href.replace('firstResult=0','firstResult='+((document.getElementById('page_num').value-1)*document.getElementById('maxSize').value));}</script>";
out.print(tempstring);//在jsp页面显示
} catch (IOException e) {
e.printStackTrace();
}
return super.doEndTag();
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getFirstResult() {
return firstResult;
}
public void setFirstResult(String firstResult) {
this.firstResult = firstResult;
}
public String getMaxSize() {
return maxSize;
}
public void setMaxSize(String maxSize) {
this.maxSize = maxSize;
}
public String getTotal() {
return total;
}
public void setTotal(String total) {
this.total = total;
}
public String getOtherParam() {
return otherParam;
}
public void setOtherParam(String otherParam) {
this.otherParam = otherParam;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Java里的权限实现
共107个文件
class:23个
java:23个
jar:21个
5星 · 超过95%的资源 需积分: 10 18 下载量 125 浏览量
2011-04-09
14:52:39
上传
评论
收藏 11.57MB ZIP 举报
温馨提示
里面是一个关于Java权限的专题。有思路,有代码。
资源推荐
资源详情
资源评论
收起资源包目录
Java里的权限实现 (107个子文件)
User.class 5KB
UserInfoBizImpl.class 4KB
RoleBizImpl.class 4KB
PaginateTag.class 4KB
UserInfoDaoImpl.class 4KB
Role.class 3KB
PopedomFilter.class 3KB
SessionUser.class 2KB
RoleDaoImpl.class 2KB
PageMode.class 2KB
TestUserinfoBiz.class 2KB
RoleDto.class 2KB
TestUserInfoDao.class 2KB
UserInfoDto.class 2KB
Role.class 1KB
UserInfo.class 1KB
PopedomDto.class 1KB
Popedom.class 1KB
SCM.class 778B
RoleBiz.class 474B
RoleDao.class 474B
UserInfoBiz.class 472B
UserInfoDao.class 472B
.classpath 2KB
style.css 3KB
style.css 3KB
index.html 2KB
main.html 819B
spring.jar 2.7MB
hibernate3.jar 2.31MB
aspectjweaver.jar 1.8MB
xwork-core-2.1.6.jar 1.49MB
freemarker-2.3.15.jar 859KB
struts2-core-2.1.8.1.jar 738KB
javassist-3.9.0.GA.jar 583KB
commons-collections-3.1.jar 546KB
antlr-2.7.6.jar 433KB
dom4j-1.6.1.jar 307KB
sqljdbc.jar 247KB
ognl-2.7.3.jar 234KB
ehcache-1.2.3.jar 203KB
aspectjrt.jar 112KB
commons-io-1.3.2.jar 86KB
commons-fileupload-1.2.1.jar 56KB
commons-logging.jar 37KB
slf4j-api-1.5.8.jar 23KB
struts2-spring-plugin-2.1.8.1.jar 16KB
jta-1.1.jar 13KB
slf4j-nop-1.5.8.jar 5KB
PaginateTag.java 4KB
User.java 4KB
UserInfoBizImpl.java 3KB
RoleBizImpl.java 3KB
UserInfoDaoImpl.java 2KB
PopedomFilter.java 2KB
Role.java 2KB
SessionUser.java 1KB
PageMode.java 1KB
TestUserInfoDao.java 1KB
RoleDaoImpl.java 1023B
UserInfoDto.java 986B
TestUserinfoBiz.java 884B
RoleDto.java 854B
UserInfo.java 804B
Role.java 736B
Popedom.java 645B
PopedomDto.java 643B
UserInfoBiz.java 463B
RoleBiz.java 437B
UserInfoDao.java 422B
RoleDao.java 401B
SCM.java 333B
login_bg.jpg 21KB
login_bg.jpg 21KB
login_button.jpg 2KB
login_button.jpg 2KB
right_title_bg.jpg 1KB
right_title_bg.jpg 1KB
checked.js 637B
checked.js 637B
index.jsp 2KB
user-findAll.jsp 2KB
role-toEdit.jsp 2KB
user-toEdit.jsp 2KB
user-toAdd.jsp 1KB
role-toAdd.jsp 1KB
role-findAll.jsp 1KB
login.jsp 1KB
MANIFEST.MF 39B
.mymetadata 310B
com.genuitec.eclipse.j2eedt.core.prefs 1KB
.project 1KB
wepull-tag.tld 1KB
角色权限.xls 32KB
applicationContext.xml 3KB
applicationContext.xml 3KB
web.xml 1KB
hibernate.cfg.xml 970B
hibernate.cfg.xml 970B
struts.xml 831B
共 107 条
- 1
- 2
资源评论
- xiaoranhaha2012-08-02刚下了看了一下 不错 就是没有表关系 希望楼主能把表关系附上
zhou2008_822
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 88-520告白(520气球).zip
- HTML+CSS+JS精品网页模板H126.rar
- n.cpp
- jdk-8u411-windows-x64下载安装可用
- vgg模型-图像分类算法对水果识别-不含数据集图片-含逐行注释和说明文档.zip
- KMP算法(Knuth-Morris-Pratt算法
- vgg模型-python语言pytorch框架训练识别化妆品分类-不含数据集图片-含逐行注释和说明文档.zip
- KMP算法(Knuth-Morris-Pratt算法
- shufflenet模型-基于人工智能的卷积网络训练识别狗的表情-不含数据集图片-含逐行注释和说明文档.zip
- EPIC Fantasy Town 1.0
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功