阅读背景:

新的struts分页

来源:互联网 

 

1.jsp页面

<table id="tablelist" class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th>通知类型</th>
                                            <th>内容</th>
                                            <th>通知时间</th>
                                            <th>是否已读</th>
                                        </tr>
                                        <c:forEach items="${pager.lists}" var="item">
                                            <tr>
                                                <td>${item.inform.classify}</td>
                                                <td>${item.texts}</td>
                                                <td>${item.strNotTime}</td>
                                                <td>
                                                    <c:if test="${item.readss==0}">
                                                    未读
                                                    </c:if>
                                                    <c:if test="${item.readss==1}">
                                                    已读
                                                    </c:if>
                                                </td>
                                            </tr>
                                        
                                         </c:forEach>
                                        
                                        
                                    </thead>
    
                                    <tbody id="fora">
                                        

                                    </tbody>

                                </table>

                                <style type="text/css">
            a {
                color: #555555;
                text-decoration: none;
                cursor: pointer;
            }
            .pages a.p_pre:hover {
                background-color: #eaeaea;
                color: #555555;
                border: 1px solid #cccccc;
            }
            .pages a {
                height: 36px;
                line-height: 36px;
                overflow: hidden;
                color: #666666;
                font-size: 16px;
                text-align: center;
                display: inline-block;
                padding: 0 12px;
                margin: 0 4px;
                border: 1px solid #cccccc;
                -webkit-border-radius: 2px;
                -moz-border-radius: 2px;
                border-radius: 2px;
            }

            .pages a:hover, .pages a.cur {
                color: #FFF;
                background-color: #DD4E62;
                border: 1px solid #DD4E62;
            }

        </style>
        <div class="pages">
            <c:if test="${pager.totalPage>=1}">
                <a href="/go.html?url=${pageContext.request.contextPath}${pager.url}&pageIndex=1" class="p_pre">首页</a>
                <c:if test="${pager.pageIndex>1}">
                    <a href="/go.html?url=${pageContext.request.contextPath}${pager.url}&pageIndex=${pager.pageIndex-1}" class="p_pre">上一页</a>
                </c:if>
                <c:forEach  var="temp" begin="${pager.pageIndex>3?pager.pageIndex-3:1}" end="${pager.totalPage-pager.pageIndex>3?pager.pageIndex+3:pager.totalPage}" step="1">
                    <c:if test="${pager.pageIndex==temp}">
                        <a href="/go.html?url=${pageContext.request.contextPath}${pager.url}&pageIndex=${temp}" class="cur">${temp}</a>
                    </c:if>
                    <c:if test="${pager.pageIndex!=temp}">
                        <a href="/go.html?url=${pageContext.request.contextPath}${pager.url}&pageIndex=${temp}">${temp}</a>
                    </c:if>
                </c:forEach>
                <c:if test="${pager.pageIndex<pager.totalPage}">
                    <a href="/go.html?url=${pageContext.request.contextPath}${pager.url}&pageIndex=${pager.pageIndex+1}" class="p_pre">下一页</a>
                </c:if>
                <a href="/go.html?url=${pageContext.request.contextPath}${pager.url}&pageIndex=${pager.totalPage}" class="p_pre">尾页</a>
            </c:if>
            <c:if test="${pager.totalPage==0}">
                <a href="/go.html?url=#" class="cur">暂无记录</a>
            </c:if>
        </div><table id="tablelist"



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: