<c:if test="${pageCount <= '1' }">
上一页
<%
//以下两个属性是由后台的request绑定的
int count = (Integer)request.getAttribute("pages");//获取总页数
int current = (Integer)request.getAttribute("pageCount");//获取当前页码
for(int i=1;i<=count;i++){
if(current == i){
%>
<%=i<10?"0"+i:i %>
<%
}else{
if(current<5 || (count-current)<5){
if(current<5){
if(i<10){
%>
<a href="/customer/select?pageCount=<%=i%>"><%=i<10?"0"+i:i %></a>
<% }
}else{
if(i+9>count){
%>
<a href="/customer/select?pageCount=<%=i%>"><%=i<10?"0"+i:i %></a>
<%
}
}
}else{
if((0<=current-i && current-i<5) || (0<=i-current && i-current<5)){
%>
<a href="/customer/select?pageCount=<%=i%>"><%=i<10?"0"+i:i %></a>
<%
}else{
if(i==0){
%>
.
<%
}
}
}
}
}
%>
<a href="/customer/select?pageCount=${pageCount+1 }">下一页</a>
</c:if>
以上是pageCount<=1时候的情况
<c:if test="${pageCount > '1' && pageCount < pages}">
<a href="/customer/select?pageCount=${pageCount-1 }">上一页</a>
<%
int count = (Integer)request.getAttribute("pages");
int current = (Integer)request.getAttribute("pageCount");
for(int i=1;i<=count;i++){
if(current == i){
%>
<%=i<10?"0"+i:i %>
<%
}else{
if(current<5 || (count-current)<5){
if(current<5){
if(i<10){
%>
<a href="/customer/select?pageCount=<%=i%>"><%=i<10?"0"+i:i %></a>
<% }
}else{
if(i+9>count){
%>
<a href="/customer/select?pageCount=<%=i%>"><%=i<10?"0"+i:i %></a>
<%
}
}
}else{
if((0<=current-i && current-i<5) || (0<=i-current && i-current<5)){
%>
<a href="/customer/select?pageCount=<%=i%>"><%=i<10?"0"+i:i %></a>
<%
}else{
if(i==0){
%>
.
<%
}
}
}
}
}
%>
<a href="/customer/select?pageCount=${pageCount+1 }">下一页</a>
</c:if>
以上是pageCount>=1 && pageCount<=pages的情况
<c:if test="${pageCount >= pages }">
<a href="/customer/select?pageCount=${pageCount-1 }">上一页</a>
<%
int count = (Integer)request.getAttribute("pages");
int current = (Integer)request.getAttribute("pageCount");
for(int i=1;i<=count;i++){
if(current == i){
%>
<%=i<10?"0"+i:i %>
<%
}else{
if(current<5 || (count-current)<5){
if(current<5){
if(i<10){
%>
<a href="/customer/select?pageCount=<%=i%>"><%=i %></a>
<% }
}else{
if(i+9>count){
%>
<a href="/customer/select?pageCount=<%=i%>"><%=i %></a>
<%
}
}
}else{
if((0<=current-i && current-i<5) || (0<=i-current && i-current<5)){
%>
<a href="/customer/select?pageCount=<%=i%>"><%=i %></a>
<%
}else{
if(i==0){
%>
.
<%
}
}
}
}
}
%>
下一页
</c:if>
以上是pageCount>pages时候的情况