欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

JSTL标签显示分页的代码实例教程

程序员文章站 2022-04-15 21:22:44
jstl显示分页 页面表格的分页显示,通过jstl标签实现 页面效果 代码如下 // 分页显示

jstl显示分页

页面表格的分页显示,通过jstl标签实现

页面效果

JSTL标签显示分页的代码实例教程

代码如下

// 分页显示
<p class="table-pagination tablepagestyle <c:if test='${simple ne false}'> row-fluid tool ui-toolbar</c:if>">
    <p class="pagination tablepagecontentstyle">
        <ul>
            <c:choose>
                <c:when test="${page.firstpage}">
                    <li class="disabled">                           
                        <a class="apagestyle" title="第一页"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', 1, this);">
                            <p class="imgpagedivstyle">
                                <img src="${ctx}/static/pageicon/start-page.png" class="imagepagestyle">
                            </p>
                        </a>
                    </li>
                    <li class="disabled">                         
                        <a class="apagestyle" title="上一页"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', ${current - 1}, this);">
                            <p class="imgpagedivstyle">
                                <img src="${ctx}/static/pageicon/up-page.png" class="imagepagestyle">
                            </p>
                        </a>
                    </li>
                </c:when>
                <c:otherwise>
                    <li>
                        <a class="apagestyle" title="第一页"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', 1, this);">
                            <p class="imgpagedivstyle">
                                <img src="${ctx}/static/pageicon/start-page.png" class="imagepagestyle">
                            </p>
                        </a>
                    </li>
                    <li>                          
                        <a class="apagestyle" title="上一页"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', ${current - 1}, this);">
                            <p class="imgpagedivstyle">
                                <img src="${ctx}/static/pageicon/up-page.png" class="imagepagestyle">
                            </p>
                        </a>
                    </li>
                </c:otherwise>
            </c:choose>

            <p class="digongdivstyle">
                <span class="page-input dispanstyle">
                    第&nbsp;<input type="text" class="input-mini inputpagestyle" value="${current}"
                                  onblur="$.table.skippage('${page.totalcount}','${pagesize}', $(this).val(), this);"/> &nbsp;页,
                </span>
                <span class="page-info gongspanstyle">共&nbsp;${page.totalpages}&nbsp;页</span>
            </p>

            <c:choose>
                <c:when test="${page.lastpage}">
                    <li class="disabled">
                        <a class="apagestyle" title="下一页"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', ${current + 1}, this);">
                            <p class="imgpagedivstyle">
                                <img src="${ctx}/static/pageicon/down-page.png" class="imagepagestyle">
                            </p>
                        </a>
                    </li>
                    <li class="disabled">
                        <a class="apagestyle" title="最后页"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', ${page.totalpages}, this);">
                            <p class="imgpagedivstyle">
                                <img src="${ctx}/static/pageicon/end-page.png" class="imagepagestyle">
                            </p>
                        </a>
                    </li>
                    <li class="disabled">
                        <a class="apagestyle" title="刷新"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', ${current}, this);">
                            <p class="imgpagedivstyle refresh-page-button">
                                <img src="${ctx}/static/pageicon/refresh-page.png" class="imagepagestyle refresh-page-button-img">
                            </p>
                        </a>
                    </li>
                </c:when>
                <c:otherwise>
                    <li>
                        <a class="apagestyle" title="下一页"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', ${current + 1}, this);">
                            <p class="imgpagedivstyle">
                                <img src="${ctx}/static/pageicon/down-page.png" class="imagepagestyle">
                            </p>
                        </a>
                    </li>
                    <li>
                        <a class="apagestyle" title="最后页"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', ${page.totalpages}, this);">
                            <p class="imgpagedivstyle">
                                <img src="${ctx}/static/pageicon/down-page.png" class="imagepagestyle">
                            </p>
                        </a>
                    </li>
                    <li >
                        <a class="apagestyle" title="刷新"
                           onclick="$.table.skippage('${page.totalcount}','${pagesize}', ${current}, this);">
                            <p class="imgpagedivstyle refresh-page-button">
                                <img src="${ctx}/static/pageicon/refresh-page.png" class="imagepagestyle refresh-page-button-img">
                            </p>
                        </a>
                    </li>
                </c:otherwise>
            </c:choose>
        </ul>

        <p class="xiangongdivstyle">
            <c:choose>
                <c:when test="${current==1}">
                    <c:choose>
                        <c:when test="${page.totalcount==0}">
                            <span class="page-info xianshispanstyle">显示&nbsp;${page.totalcount}&nbsp;条,</span>
                        </c:when>
                        <c:otherwise>
                            <c:if test="${page.totalcount<page.pagesize}">
                                <span class="page-info xianshispanstyle">显示&nbsp;1&nbsp;-&nbsp;${page.totalcount}&nbsp;条,</span>
                            </c:if>
                            <c:if test="${page.totalcount>page.pagesize}">
                                <span class="page-info xianshispanstyle">显示&nbsp;1&nbsp;-&nbsp;${page.pagesize}&nbsp;条,</span>
                            </c:if>
                        </c:otherwise>
                    </c:choose>
                </c:when>
                <c:otherwise>
                    <c:if test="${(page.totalcount - page.pagesize * (current - 1)) >= page.pagesize}">
                        <span class="page-info xianshispanstyle">显示&nbsp;${page.pagesize*(current-1)+1}&nbsp;-&nbsp;${page.pagesize*current}&nbsp;条,</span>
                    </c:if>
                    <c:if test="${(page.totalcount - page.pagesize * (current - 1)) < page.pagesize}">
                        <span class="page-info xianshispanstyle">显示&nbsp;${page.pagesize*(current-1)+1}&nbsp;-&nbsp;${page.totalcount}&nbsp;条,</span>
                    </c:if>
                </c:otherwise>
            </c:choose>
            <span class="page-info xiangongspanstyle">共&nbsp;${page.totalcount}&nbsp;条</span>
        </p>
    </p>
</p>