java 像bbs.csdn一样的分页

           <!-- 分页模块 --步奏 :①考如下代码②配置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 -->		            	
		            	
           

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值