zoukankan      html  css  js  c++  java
  • jsp页面简单分页

        <%-- <div align="center" style="margin-top:30px;">当前第:${param.page }页;共:${ param.totalPage}页<a href="getUserListServlet?page=1">首页</a>
      <c:if test="${param.page != 1}"><a href="getUserListServlet?page=${param.page-1}">上一页</a></c:if><c:if test="${param.page ==1}">上一页</c:if>
         <c:if test="${param.page != param.totalPage}"><a href="getUserListServlet?page=${param.page+1}">下一页</a></c:if><c:if test="${param.page == param.totalPage}">下一页</c:if>
         <a href="getUserListServlet?page=${param.totalPage}">尾页</a></div> --%>
            <div align="center" style="margin-top: 30px;">
                当前第:${param.page}页,共${param.totalPage}页
                <a href="SeleServlet?page=1">首页</a>
                <c:if test="${param.page != 1}">
                    <a href="SeleServlet?page=${param.page - 1}">上一页</a>
                </c:if>
                <c:if test="${param.page == 1}">上一页</c:if>
                <c:if test="${param.page != param.totalPage}">
                    <a href="SeleServlet?page=${param.page + 1}">下一页</a>
                </c:if>
                <c:if test="${param.page == param.totalPage}">下一页</c:if>
                <a href="SeleServlet?page=${param.totalPage}">尾页</a>
            </div>

    转化为项目代码

     <div  style="margin: 0 0 10px 0 ;color: red;text-align:center;line-height: 30px;">
                Current :The ${currentPage} page,&nbsp;&nbsp;&nbsp;Total: ${totalPage} pages,&nbsp;&nbsp;&nbsp;
                <a href="<s:url namespace="/business" action="search?gosearch=%{gosearch}&&categoryIdHeader=%{categoryIdHeader}&&currentPage=1"/>">FirstPage</a>&nbsp;&nbsp;&nbsp;
                <c:if test="${currentPage != 1}">
                    <a href="<s:url namespace="/business" action="search?gosearch=%{gosearch}&&categoryIdHeader=%{categoryIdHeader}&&currentPage=%{currentPage - 1}"/>">Previous</a>&nbsp;&nbsp;&nbsp;
                </c:if>
                <c:if test="${currentPage == 1}">Previous&nbsp;&nbsp;&nbsp;</c:if>
                <s:iterator value="totalPages" status="page">
                    <a href="<s:url namespace="/business" action="search?gosearch=%{gosearch}&&categoryIdHeader=%{categoryIdHeader}&&currentPage=%{#page.index+1}"/>"><s:property value="#page.index+1"/></a>&nbsp;
                </s:iterator>
                <c:if test="${currentPage != totalPage}">
                    <a href="<s:url namespace="/business" action="search?gosearch=%{gosearch}&&categoryIdHeader=%{categoryIdHeader}&&currentPage=%{currentPage + 1}"/>">Next</a>&nbsp;&nbsp;&nbsp;
                </c:if>
                <c:if test="${currentPage == totalPage}">Next</c:if>&nbsp;&nbsp;&nbsp;
                <a href="<s:url namespace="/business" action="search?gosearch=%{gosearch}&&categoryIdHeader=%{categoryIdHeader}&&currentPage=%{totalPage}"/>">LastPage</a>&nbsp;&nbsp;&nbsp;
            </div>

    需要传入的参数currentPage; totalPage;totalPages;

  • 相关阅读:
    【洛谷】1852:[国家集训队]跳跳棋【LCA】【倍增?】
    【POJ】1835:宇航员【模拟】【三维行走】
    【BZOJ】3195: [Jxoi2012]奇怪的道路【状压/奇偶性】【思路】
    【10.24校内测试】【欧拉路径(有向+无向)】【双向链表/树状数组/线段树】
    【POJ】1840:Eqs【哈希表】
    【洛谷】4317:花神的数论题【数位DP】
    【POJ】1486:Sorting Slides【二分图关键边判定】
    算法模板
    Redis源码阅读一:简单动态字符串SDS
    总结下c/c++的一些调试经验
  • 原文地址:https://www.cnblogs.com/cuiyf/p/2964608.html
Copyright © 2011-2022 走看看