万能分页标签

2010写的一个jsp分页标签, 基本能实现任何效果分页(如谷歌, 百度分页, AJAX分页等), 并且能保存查询参数, 自认为比较强大, 下面记录使用方法:
 先上一个效果:
 

1. pagebar.jar加入lib

2. action里代码(最少只需要加入3行代码):
IConditionHelper helper = ConditionHelper.getInstance(ServletActionContext.getRequest());
            
            UserLstReq userLstReq 
= new UserLstReq();
            userLstReq.setUserName(userName);
            userLstReq.setBeginIndex(helper.getBeginIndex());
            userLstReq.setPageSize(helper.getPageSize());
            
            helper.getCondition(userLstReq, UserLstReq.
class);
            
            
            UserLstRes res 
= userService.queryUsers(userLstReq);
            HttpServletRequest request 
= ServletActionContext.getRequest();
            request.setAttribute(
"list", res.getResultLst());
            request.setAttribute(
"page"new BasePageBarBean(helper, res.getCount()));
   

3. jsp代码(最好是写在一jsp里, 再include方便更改)
   <%@ taglib uri="http://www.huiwanpeng.com" prefix="p"%>
   
<p:pagebar totalRowCount="${page.totalRowCount}" action="${page.action}" pageSize="${page.pageSize}" currentPageNum="${page.currentPageNum}" disableCss="color:green">
 总行数#totalRowCount#   
|  
 总页数#totalPageCount#  
|
 当前第#currentPageNum#页  
|
 每页数#pageSize# 
| 
 
<a onclick="#callFirstPageFun#">第一页</a>| 
 
<a onclick="#callForePageFun#"  style="#forePageDisableCss#">上一页</a>|
 
<a onclick="#callNextPageFun#" style="#nextPageDisableCss#">下一页</a> | 
 
<a onclick="#callLastPageFun#">最后页</a> 
 
<p:loop positiveStep="2" negativeStep="4" isFill="true" currentPageCss="color:red">
  
<a style="#currentPageCss#" onclick="#callLoopPageFun#">#currentPageNum# </a>
 
</p:loop>
 
<input id="#inputPageNumId#" type="text" style="width:20px"/><input type="button" value="go" onclick="#callGoFun#"/>
   
</p:pagebar>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值