现在的位置: 首页 > 综合 > 正文

java web

2013年07月18日 ⁄ 综合 ⁄ 共 998字 ⁄ 字号 评论关闭
<a href="list.do?nowPage=1">【首页】</a>
<c:if test="${pageNumber>1}">
<a href="list.do?nowPage=${pageNumber-1 }">上一页</a>
</c:if>
<c:forEach var="x" begin="${1 }" end="${pageCount}" step="1">
	<c:choose>
		<c:when test="${pageNumber eq x}">
			<font color="red">${pageNumber }</font>
		</c:when>
		<c:otherwise>
		<!-- 如果总页面大于5 -->
			<c:if test="${pageCount>5}">
				<c:if test="${pageNumber>3 && pageCount>pageNumber+1}">
						<c:if test="${x>pageNumber-3 && x<pageNumber+3}">
							<a href="list.do?nowPage=${x }">${x }</a>
						</c:if>
				</c:if>
				<c:if test="${pageNumber>3 && pageCount<pageNumber+2}">
					<c:if test="${x>pageCount-5}">
						<a href="list.do?nowPage=${x }">${x }</a>
					</c:if>
				</c:if>
				<!-- 如果当前页面小于3,则显示12345 -->
				<c:if test="${pageNumber<4}">
					<c:if test="${x<6}">
						<a href="list.do?nowPage=${x }">${x }</a>
					</c:if>
				</c:if>
			</c:if>
		<!-- 如果总页面小于5,则全部显示 -->
			<c:if test="${pageCount<6}">
				<a href="list.do?nowPage=${x }">${x }</a>
			</c:if>
		</c:otherwise>
</c:choose>
</c:forEach>
<c:if test="${pageNumber<pageCount}">
	<a href="list.do?nowPage=${pageNumber+1 }">下一页</a>
</c:if>
<a href="list.do?nowPage=${pageCount }">【尾页】</a>

 

抱歉!评论已关闭.