JSP公用分页模块+数字分页

JSP公用分页模块+数字分页

我的博客  http://blog.csdn.net/yjflinchong   转发请注明来源!


<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:if test="${web.page!=null}">
<div class="fenye search">
<p>
<input type="hidden" name="page.pageSize" value="${web.page.pageSize }"/>
<input type="hidden" name="page.recordCount" id="pageCount" value="${web.page.pageCount }"/>
<span> 共${web.page.pageCount}页,第${web.page.currentPage }页</span>
<a href="javascript:goTOPage(${web.page.currentPage-1 })" class="f_prev">上一页</a>
<c:if test="${web.page.currentPage-3 <= web.page.pageCount && web.page.currentPage > 2}"><a href="javascript:goTOPage(1)" <c:if test="${web.page.currentPage==1 }">class="active"</c:if>>1</a><a href="javascript:;">...</a></c:if>
<c:forEach begin="0" end="${web.page.pageCount-1}" varStatus="status"><c:if test="${web.page.currentPage - status.index >= -1 && web.page.currentPage <= status.index+2}"><a <c:if test="${web.page.currentPage==status.index + 1 }">class="active"</c:if> href="javascript:goTOPage(${status.index+1 })">${status.index+1 }</a></c:if></c:forEach>
<c:if test="${web.page.currentPage+2 < web.page.pageCount}"><a href="javascript:;">...</a><a href="javascript:goTOPage(${web.page.pageCount })">${web.page.pageCount }</a></c:if>
<a href="javascript:goTOPage(${web.page.currentPage+1 })" class="f_next">下一页</a>
到<input type="text" name="page.currentPage" id="pagecurrentPage" size="2" value="${web.page.currentPage }"/>页
<input type="button" class="button" οnclick="goTOPage(document.getElementById('pagecurrentPage').value)" value="跳转"  />
</p>
</div>
<script>
    function goTOPage(num){
        if(num>0&&num<=document.getElementById("pageCount").value){
            document.getElementById("pagecurrentPage").value = num;
            if('${web.page.pageFormName}'!=''){
                alert(document.forms['${web.page.pageFormName}'].action);
                document.forms['${web.page.pageFormName}'].submit();
            }else{
                document.forms[0].submit();
            }
        }
    }
</script>
</c:if>


page实体参数

private int pageSize;// 每页显示的条数
	private int recordCount;// 总共的条数
	private int currentPage;// 当前页面
	private String pageFormName;// 分页表单名
	private int pageCount;


JSP公用分页模块+数字分页 来源:yjflinchong CSDN


  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值