zoukankan      html  css  js  c++  java
  • jstl分页

          效果:

          

    注释:

      totalPage(总页数):全部记录数/每页的记录数

      page:当前的页码

    <c:if test="${totalPage!=1}">  
                        <c:choose>  
                            <c:when test="${requestScope.page<=5}">  
                                <c:forEach var="i" begin="2" end="${requestScope.page}">  
                                    <td><a href="ViewServlet?currentPage=${i}">[${i }]</a>&nbsp;</td>  
                                </c:forEach>  
                            </c:when>  
                            <c:otherwise>  
                                ...&nbsp;  
                                <c:forEach var="i" begin="${requestScope.page-3}"  
                                    end="${requestScope.page}">  
                                   <td><a href="javascript:goPage(${i})">[${i }]</a>&nbsp;</td>  
                                </c:forEach>  
                            </c:otherwise>  
                        </c:choose>  
                        <c:choose>  
                            <c:when test="${requestScope.page>=totalPage-4   
                                || totalPage-4<=0}">  
                                <c:forEach var="i" begin="${requestScope.page+1}"  
                                    end="${totalPage}">  
                                    <td><a href="javascript:goPage(${i})">[${i }]</a>&nbsp;</td>
                                </c:forEach>  
                            </c:when>  
                            <c:otherwise>  
                                <c:forEach var="i" begin="${requestScope.page+1}"  
                                    end="${requestScope.currentPage+3}">  
                                    <td><a href="javascript:goPage(${i})">[${i }]</a>&nbsp;</td>  
                                </c:forEach>  
                                ...&nbsp;  
                                <td><a href="javascript:goPage(${totalPage})">  
                                    [${totalPage}]</a>&nbsp;</td>
                            </c:otherwise>  
                        </c:choose>  
                    </c:if>

  • 相关阅读:
    《Django By Example》第十二章(终章) 中文 翻译 (个人学习,渣翻)
    《Django By Example》第十一章 中文 翻译 (个人学习,渣翻)
    《Django By Example》第十章 中文 翻译 (个人学习,渣翻)
    《Django By Example》第九章 中文 翻译 (个人学习,渣翻)
    《Django By Example》第八章 中文 翻译 (个人学习,渣翻)
    《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
    我的superui开源后台bootstrap开发框架
    LayoutInflater 总结
    Android屏幕分辨率概念(dp、dip、dpi、sp、px)
    android studio安装问题
  • 原文地址:https://www.cnblogs.com/ClodThunder/p/4154414.html
Copyright © 2011-2022 走看看