| 贵 州 学 习 网 |
|
二,根据总的页数,当前页 这样的话构造函数应该写成: public pagebean(int totalrows,int currentpage) { this.totalrows = totalrows; this.currentpage = currentpage; if(currentpage < 2) haspreviouspage = false; else haspreviouspage = true; if ((totalrows % pagerecorders) == 0) { totalpages = totalrows / pagerecorders; } else { totalpages = totalrows / pagerecorders + 1; } if (currentpage < totalpages) { hasnextpage = true; nextpage = currentpage + 1; pagestartrow = (currentpage - 1)*pagerecorders; this.pageendrow = pagestartrow + pagerecorders; } else if(currentpage == totalpages){ pagestartrow = (currentpage - 1)*pagerecorders; this.pageendrow = totalrows; hasnextpage = false; nextpage = currentpage; } if(currentpage < 2){ previouspage = currentpage; haspreviouspage = false; }else if(currentpage > 1){ previouspage = currentpage-1; haspreviouspage = true; } } 本文共2页: 第 [1] [2] 页
|
责任编辑:gzu521