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;

  • 相关阅读:
    Android 在资源文件(res/strings.xml)定义一维数组,间接定义二维数组
    Android 设计模式之MVC模式
    Android Studio 1.0首次安装遇到的问题,无法下载SDK
    android 项目中规范使用SharedPreferences
    Android 在布局容器中动态添加控件
    Android ble 蓝牙4.0 总结一
    Mac Android签名生成keystore
    Android ndk 加载简单的gif 图像
    Android EventBus
    c语言内存
  • 原文地址:https://www.cnblogs.com/cuiyf/p/2964608.html
Copyright © 2011-2022 走看看