zoukankan      html  css  js  c++  java
  • 用c标签实现分页页码列表

    private int totalPageCount = 1;// 总页数
    private int pageSize = 10;// 页面大小,即每页显示记录数
    private int totalCount = 0;// 记录总数
    private int currPageNo = 1;// 当前页码
    List<T> list = new ArrayList<>();// 每页集合

     1 <div class="paging wrapfix">
     2                     <div class="total">
     3                         共有${dbPagetotalCount}条记录&nbsp;当前${dbPage.currPageNo}/${dbPage.totalPageCount}页
     4                     </div>
     5                     <div class="pn">
     6                         <a
     7                             href="reception?flag=2&cid=${cate.cid}&pageNo=${(pageNo - 1) < 1 ? pageNo : (pageNo - 1)}"
     8                             title="上一页" class="nobar">上一页</a>
     9 
    10                         <c:choose>
    11                             <%--总页数是否小于10全部显示--%>
    12                             <c:when test="${dbPage.totalPageCount<=10}">
    13                                 <c:set var="begin" value="1"></c:set>
    14                                 <c:set var="end" value="${dbPage.totalPageCount}" />
    15                             </c:when>
    16                             <c:otherwise>
    17                                 <%--求页码列表范围--%>
    18                                 <c:set var="begin" value="${dbPage.currPageNo-5}" />
    19                                 <c:set var="end" value="${dbPage.currPageNo+4}" />
    20                                 <%--头部超出--%>
    21                                 <c:if test="${begin<1}">
    22                                     <c:set var="begin" value="1" />
    23                                     <c:set var="end" value="10" />
    24                                 </c:if>
    25                                 <%--尾部超出--%>
    26                                 <c:if test="${end>dbPage.totalPageCount}">
    27                                     <c:set var="begin" value="${dbPage.totalPageCount-9}" />
    28                                     <c:set var="end" value="${dbPage.totalPageCount}" />
    29                                 </c:if>
    30                             </c:otherwise>
    31                         </c:choose>
    32                         <c:forEach begin="${begin}" end="${end}" var="i">
    33                             <%--当前页码--%>
    34                             <c:choose>
    35                                 <c:when test="${i==dbPage.currPageNo}">
    36                                     <font color="blue" size="3px">${i}</font>
    37                                 </c:when>
    38                                 <c:otherwise>
    39                                     <a href="reception?flag=2&cid=${cate.cid}&pageNo=${i}">${i}</a>
    40                                 </c:otherwise>
    41                             </c:choose>
    42                         </c:forEach>
    43 
    44                         <a
    45                             href="reception?flag=2&cid=${cate.cid}&pageNo=${(pageNo + 1) > dbPage.totalPageCount ? pageNo : (pageNo + 1)}"
    46                             title="下一页" class="nobar">下一页</a>
    47                     </div>
    48                 </div>
  • 相关阅读:
    收藏篇基础命令
    itchat+图灵机器人实现python登录微信并自动回复
    四级物理实验
    天行数据网易云热评接口python脚本模板运行出错||socket.gaierror: [Errno 11001] getaddrinfo failed
    每日一道: 两数之和 简单
    每日一道:求和
    每日一道:四数之和
    每日一道:最接近的三数之和
    每日一道:盛最多水的容器
    MySQL中GRANT和IDENTIFIED同时使用时出现near 'IDENTIFIED BY...” at line 1错误
  • 原文地址:https://www.cnblogs.com/lingdu9527/p/11047246.html
Copyright © 2011-2022 走看看