• 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;

  • 相关阅读:
    ubuntu13.04 安装java
    PHP shell模式下执行PHP文件报错
    python urllib2 cookie 设置
    新浪微博模拟登录(Python+RSA加密算法)附源代码(转)
    Python 实现腾讯微博模拟登录 (附源码)
    python中的字符串与16进制的转换
    mysql in和exists性能比较和使用
    linux分析dump vmcore文件
    SecureCRT密钥key远连接程ssh证书登录Linux
    /tmp清理机制
  • 原文地址:https://www.cnblogs.com/cuiyf/p/2964608.html
Copyright © 2020-2023  润新知