Prodigy/kf智
          我的博客
          posts - 20,comments - 7,trackbacks - 0
          在struts-config.xml里配置 PageBean這個類是進行分頁的: package com.xiaozhi.pagebean; public class PageBean { //設置當前頁數 private int currentPage = 0 ; //一共有多少條數據 private int countdata = 0 ; //1頁里應該有多少數據 private int everypage = 0 ; public int getCurrentPage() { if(countdata <= 0) { return 0 ; } return this.currentPage; } //設置當前頁的并進行判斷 public void setCurrentPage(int currentPage) { int countpage = 0 ; countpage = this.getCountPage() ; if(currentPage < 0) { this.currentPage = 0 ; return ; } else if(currentPage >= countpage) { this.currentPage = countpage-1 ; return ; } this.currentPage = currentPage; } public int getCountdata() { return countdata; } public void setCountdata(int countdata) { this.countdata = countdata; } public int getEverypage() { return everypage; } public void setEverypage(int everypage) { this.everypage = everypage; } //得到一共有多少頁 public int getCountPage() { if(countdata%everypage == 0) { return countdata/everypage ; } else { return countdata/everypage+1 ; } } //得到起始頁的數據(是當前頁的開始數據) public int getBeginData() { // System.out.println("*****@@@@"+this.currentPage+"*********") ; // // System.out.println("*****"+this.currentPage * this.countdata+"*********") ; return this.currentPage * this.everypage ; } //得到結尾的數據(是當前頁的最后的數據) public int getEndData() { // System.out.println("%%%%%%%%%%"+((this.currentPage+1)*this.everypage-1)+"%%%%%%%%%%%%%%") ; return (this.currentPage+1)*this.everypage-1 ; } }
          posted on 2006-04-17 11:07 xiaozhi 閱讀(315) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 勃利县| 宝丰县| 广河县| 本溪市| 三原县| 潢川县| 军事| 吉水县| 德令哈市| 海阳市| 罗定市| 囊谦县| 长宁区| 沾化县| 洪湖市| 九龙城区| 隆林| 基隆市| 南江县| 郴州市| 尉氏县| 涞水县| 工布江达县| 泾阳县| 原阳县| 泰顺县| 板桥市| 新乡市| 手游| 安龙县| 甘南县| 广西| 胶州市| 历史| 舟山市| 清新县| 潼关县| 梨树县| 七台河市| 云霄县| 怀集县|