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;

  • 相关阅读:
    查看数据库中指定用户下每个表占的实际空间大小
    数据库中查询列数据是否有重复
    oracle查看数据库的字符集
    【转】oracle数据库中varchar2陷阱
    cursor详解
    vs报算术运算溢出的错误
    count(1)比count(*)效率高
    基于NPOI的Execl导入导出例子
    day4-2数组及方法
    day4-1深入理解对象之创建对象
  • 原文地址:https://www.cnblogs.com/cuiyf/p/2964608.html
Copyright © 2011-2022 走看看