jsp翻页逻辑及页标签
[1][2][3]4[5][6][7][8][9]
当前页curPage
页总数pageCount
显示标签数showCount = 9
开始start = curPage -4 >= 1 ?curPage - 4 : 1
结束end = curPage +4 <= pageCount? curPage + 4:pageCount
for(int i=start; i<end+1; i++){
%><a href="...">I</a><%
} www.zzzyk.com
PageUtilImpl apage = (PageUtilImpl)request.getAttribute("page");
long curPage = apage.getCurPage();
long pageCount = apage.getPageCount();
long start = curPage - 4 > 1 ? curPage - 4 : 1;
long end = curPage +4 <= pageCount ? curPage + 4 : pageCount;
for(long i = start; i <= end; i++){
if(i == curPage)out.print(i);
else{%>
<a href="${theURL}${mark}page.toPage=<%=i%>${para}">[<%=i%>]</a>
<%}
}
补充:Web开发 , Jsp ,