[js]ページングページには5ページしか表示されません

2255 ワード

    :<a>${queryParams.paging.records}</a><br />
		    :<a>${queryParams.paging.pageSize}</a><br />
		     :<a>${queryParams.paging.currentPage}</a><br />
		   :<a>${queryParams.paging.pages}</a><br />
		<%
			QueryParams queryParams = (QueryParams)request.getAttribute("queryParams");
			int records = queryParams.getPaging().getRecords();
			int pageSize = queryParams.getPaging().getPageSize();
			int currentPage = queryParams.getPaging().getCurrentPage();
			int pages = queryParams.getPaging().getPages();
			
			int cur = currentPage;
			
			if(currentPage == 0||currentPage == 1){
   			}else{
   				out.print("<a href='selectbypage?currentPage=1'>  </a>|");
	   			out.print("<a href='selectbypage?currentPage="+(currentPage-1)+"'>    </a> | ");
   			}
   			
   			if(currentPage<=3){
   				for(int i=1; i<=(pages<=5?pages:5); i++){
   					if(i==currentPage){
   						out.print(i+" | ");
   					}else{
   						out.print("<a href='selectbypage?currentPage="+i+"'>"+i+"</a> | ");
   					}
   				}
   			}else if(currentPage>3 && pages<=(currentPage+2)){
   				for(int i=pages-4; i<=pages; i++){
   					if(i==currentPage){
   						out.print(i+" | ");
   					}else{
	   					out.print("<a href='selectbypage?currentPage="+i+"'>"+i+"</a> | ");
   					}
   				}
   			}else if(currentPage>3 && pages>(currentPage+2)){
   				for(int i=currentPage-2; i<=currentPage+2; i++){
   					if(i==currentPage){
   						out.print(i+" | ");
   					}else{
	   					out.print("<a href='selectbypage?currentPage="+i+"'>"+i+"</a> | ");
   					}
   				}
   			}
   			
			if(currentPage == pages){
   			}else{
	   			out.print("<a href='selectbypage?currentPage="+(currentPage+1)+"'>    </a> | ");
   				out.print("<a href='selectbypage?currentPage="+pageSize+"'>  </a>|");
   			}

%>