【DRP】表格—分页查询(2)—翻页、显示页码
翻页:
前台代码:
1 <div align="right"> 2 <input name="btnTopPage" class="button1" type="button" 3 id="btnTopPage" value="|<< " title="首页" 4 onClick="topPage()"> 5 <input name="btnPreviousPage" class="button1" type="button" 6 id="btnPreviousPage" value=" < " title="上页" 7 onClick="previousPage()"> 8 <input name="btnNextPage" class="button1" type="button" 9 id="btnNextPage" value=" > " title="下页" onClick="nextPage()"> 10 <input name="btnBottomPage" class="button1" type="button" 11 id="btnBottomPage" value=" >>|" title="尾页" 12 onClick="bottomPage()"> 13 </div>
js代码:
1 //首页 2 function topPage() { 3 window.self.location = "user_maint.jsp?pageNo=<%=pageModel.getTopPageNo()%>"; 4 } 5 //上一页 6 function previousPage() { 7 window.self.location = "user_maint.jsp?pageNo=<%=pageModel.getPreviousPageNo()%>"; 8 } 9 //下一页 10 function nextPage() { 11 window.self.location = "user_maint.jsp?pageNo=<%=pageModel.getNextPageNo()%>"; 12 } 13 //尾页 14 function bottomPage() { 15 window.self.location = "user_maint.jsp?pageNo=<%=pageModel.getBottomPageNo()%>"; 16 }
显示页码:
前台代码:
1 <div align="left"> 2 <font color="#FFFFFF"> 共 <%=pageModel.getTotalPages() %> 页</font> 3 <font color="#FFFFFF">当前第</font>  4 <font color="#FF0000"><%=pageModel.getPageNo() %></font>  5 <font color="#FFFFFF">页</font> 6 </div>
调用统一入口:
1 PageModel pageModel = UserManager.getInstance().findUserList(pageNo, pageSize);
总结:不断提高自己编码效率!