学习网考试学习资料

Gzu521.com

我的struts分页算法的实现(3)(1)

微软认证   点击:次   发布时间:2006-11-30   【字体: 】   来源:Gzu521.com
贵 州 学 习 网
二,根据总的页数,当前页
这样的话构造函数应该写成:
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

IT认证分类
计算机软件水平考试
全国计算机等级考试
思科认证
微软认证
ORACLE/CIW认证
Linux认证
JAVA认证
其它认证
分类推荐信息
更多...
大类最新文章
更多...