<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>