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

文章作者 100test 发表时间 2007:03:14 16:35:36
来源 100Test.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.
}
}

相关文章


JBuilderX SQLServer开发hibernate
我的struts分页算法的实现(2)
我的struts分页算法的实现(3)
我的struts分页算法的实现(1)
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛