共${page.countrow }条记录
共${page.countpage }页
<a href="${pageContext.request.contextPath }/servlet/PageCustServlet?thispage=${page.firstpage }">首页</a>
<a href="${pageContext.request.contextPath }/servlet/PageCustServlet?thispage=${page.prepage }">上一页</a>
<!-- 分页逻辑开始 -->
<c:if test="${page.countpage<=5}">
<c:set var="begin" value="1" scope="page"></c:set>
<c:set var="end" value="${page.countpage}" scope="page"></c:set>
</c:if>
<c:if test="${page.countpage>5}">
<c:choose>
<c:when test="${page.thispage<=3}">
<c:set var="begin" value="1" scope="page"></c:set>
<c:set var="end" value="5" scope="page"></c:set>
</c:when>
<c:when test="${page.thispage>=page.countpage-2}">
<c:set var="begin" value="${page.countpage-4}" scope="page"></c:set>
<c:set var="end" value="${page.countpage}" scope="page"></c:set>
</c:when>
<c:otherwise>
<c:set var="begin" value="${page.thispage-2}" scope="page"></c:set>
<c:set var="end" value="${page.this page+2}" scope="page"></c:set>
</c:otherwise>
</c:choose>
</c:if>
<c:forEach begin="${begin}" end="${end}" step="1" var="i">
<c:if test="${i == page.thispage}">
${i }
</c:if>
<c:if test="${i != page.thispage}">
<a href="${pageContext.request.contextPath }/servlet/PageCustServlet?thispage=${i}">${i }</a>
</c:if>
</c:forEach>
<!-- 分页逻辑结束 -->
<a href="${pageContext.request.contextPath }/servlet/PageCustServlet?thispage=${page.nextpage }">下一页</a>
<a href="${pageContext.request.contextPath }/servlet/PageCustServlet?thispage=${page.lastpage }">尾页</a>
跳到<input type="text" value="${page.thispage }" style="width: 40px" οnchange="changePage(this)"/>页
Jsp页面简单分页处理
最新推荐文章于 2023-02-28 20:49:18 发布