【DRP】表格—分页查询(2)—翻页、显示页码

翻页:

前台代码:

 1              <div align="right">
 2                             <input name="btnTopPage" class="button1" type="button"
 3                                 id="btnTopPage" value="|&lt;&lt; " title="首页"
 4                                 onClick="topPage()">
 5                             <input name="btnPreviousPage" class="button1" type="button"
 6                                 id="btnPreviousPage" value=" &lt;  " title="上页"
 7                                 onClick="previousPage()">
 8                             <input name="btnNextPage" class="button1" type="button"
 9                                 id="btnNextPage" value="  &gt; " title="下页" onClick="nextPage()">
10                             <input name="btnBottomPage" class="button1" type="button"
11                                 id="btnBottomPage" value=" &gt;&gt;|" 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">&nbsp;&nbsp;<%=pageModel.getTotalPages() %>&nbsp;</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
3                             <font color="#FFFFFF">当前第</font>&nbsp
4                             <font color="#FF0000"><%=pageModel.getPageNo() %></font>&nbsp
5                             <font color="#FFFFFF"></font>
6                         </div>

 

调用统一入口:

1 PageModel pageModel = UserManager.getInstance().findUserList(pageNo, pageSize);    

 

总结:不断提高自己编码效率!

 

posted @ 2016-06-28 15:54  像大海一样生活  阅读(200)  评论(0编辑  收藏  举报