<!-- 分页模块 --步奏 :①考如下代码②配置url 跳转,③ tclMaintainKnowall.id改掉即可-->
<!-- 分页start -->
<ul class="pages">
<%String url=basePath+"tvs/tofindmaintainmanage.do?currentstatuts="; %>
<li><a href="<%=url%>${currentstatuts}&page=1" >首页</a></li>
<c:choose>
<c:when test="${pb.currentPage<5}">
<c:choose>
<c:when test="${pb.totalPage<5}">
<c:forEach var="i" begin="1" end="${pb.totalPage}">
<c:if test="${pb.currentPage!=i}">
<a href="<%=url %>${currentstatuts}&page=${i}">
<li >
${i }
</li>
</a>
</c:if>
<c:if test="${pb.currentPage==i}">
<a href="<%=url %>${currentstatuts}&page=${i}">
<li class="on">
${i }
</li>
</a>
</c:if>
</c:forEach>
</c:when>
<c:otherwise>
<c:forEach var="i" begin="1" end="5">
<c:if test="${pb.currentPage!=i}">
<a href="<%=url %>${currentstatuts}&page=${i}">
<li >
${i }
</li>
</a>
</c:if>
<c:if test="${pb.currentPage==i}">
<a href="<%=url %>${currentstatuts}&page=${i}">
<li class="on">
${i }
</li>
</a>
</c:if>
</c:forEach>
<li class="nobolder">...</li>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<li class="nobolder">...</li>
<!-- 当处于最后钱3页的时候,-->
<c:choose>
<c:when test="${pb.currentPage>=pb.totalPage-3}">
<c:forEach var="i" begin="${pb.totalPage-3}" end="${pb.totalPage}">
<c:if test="${pb.currentPage!=i}">
<a href="<%=url %>${currentstatuts}&page=${i}">
<li >
${i }
</li>
</a>
</c:if>
<c:if test="${pb.currentPage==i}">
<a href="<%=url %>${currentstatuts}&page=${i}">
<li class="on">
${i }
</li>
</a>
</c:if>
</c:forEach>
</c:when>
<c:otherwise>
<c:forEach var="i" begin="${pb.currentPage-2}" end="${pb.currentPage+3}">
<c:if test="${pb.currentPage!=i}">
<a href="<%=url %>${currentstatuts}&page=${i}">
<li >
${i }
</li>
</c:if>
</a>
<c:if test="${pb.currentPage==i}">
<a href="<%=url %>${currentstatuts}&page=${i}">
<li class="on">
${i }
</li>
</a>
</c:if>
</c:forEach>
<li class="nobolder">...</li>
</c:otherwise>
</c:choose>
</c:otherwise>
</c:choose>
<li><a href="<%=url %>${currentstatuts}&page=${pb.totalPage }" >尾页</a></li>
<li class="nobolder">到第<input type="text" id="xxpage" value="${pb.currentPage}" size="1" />页</li>
<li class="nobolder"><input class="search_btn" type="button" οnclick="gotoPage(${currentstatuts});"/></li>
<script >
function gotoPage(id){
var txt=document.getElementById("xxpage");
if(!isNaN(txt.value))
{ var url='<%=url%>'+id;
txt="&page="+txt.value;
window.location.href=url+txt;
return false;
}
}
</script>
</ul>
<!-- 分页end -->
java 像bbs.csdn一样的分页
最新推荐文章于 2024-09-05 03:29:51 发布