通过计数自己写程序分页。
http://expert.csdn.net/Expert/topic/1523/1523918.xml?temp=.9306757
http://expert.csdn.net/Expert/topic/1421/1421953.xml?temp=.8832514
应该有帮助

解决方案 »

  1.   

    http://linuxfree.myrice.com/jsp/fy.htmjsp中的分页
      

  2.   

    我想在bean里面写分页,返回一个ResuletSet对象,参数是sql语句,当前页,每页行数。这样的例子有吗?
      

  3.   

    /**
        * 翻页处理
        */
       private void locationPage(){        
            this.request = this.getRequest();
            strStartRecord = request.getParameter("startRecord");
    if(strStartRecord==null||strStartRecord.length()<=0){
    strStartRecord = "0";
    } strDisplayLength = request.getParameter("displayLength");
    if(strDisplayLength==null||strDisplayLength.length()<=0){
    strDisplayLength="10";
    } if(!(strDisplayLength==null||strDisplayLength.length()<=0)){
    lDisplayLength=Integer.parseInt(strDisplayLength);
    }
    else lDisplayLength =10; page_location = request.getParameter("page_location");
    if(page_location==null||page_location.length()<=0){
    page_location = "";
    }
    try{
    if (Integer.parseInt(page_location)<=0)
    page_location = "";
    }
    catch(NumberFormatException e){
    page_location = "";
    } if(!(page_location.length()==0)){
                    String rsCount = request.getParameter("count");
                    long lrsCount = Integer.parseInt(rsCount);
                    long temp = Integer.parseInt(page_location)*lDisplayLength;
                    if (lrsCount >= temp){
      lStartRecord=(Integer.parseInt(page_location)-1)*lDisplayLength;
      strStartRecord = String.valueOf(lStartRecord);
                    }
                    else {
                      if (lrsCount%lDisplayLength ==0)
                          lStartRecord = lrsCount/lDisplayLength*lDisplayLength - lDisplayLength;
                      else lStartRecord = lrsCount/lDisplayLength*lDisplayLength;
      strStartRecord = String.valueOf(lStartRecord);
                    }
    }
    else if(!(strStartRecord==null||strStartRecord.length()<=0)){
    lStartRecord=Integer.parseInt(strStartRecord);
    }
        }   public int getCount(){
          return this.count;
       }   public String getStrStartRecord(){
          return this.strStartRecord;
       }   public String getStrDisplayLength(){
          return this.strDisplayLength;
       }   public long getLStartRecord(){
          return this.lStartRecord;
       }   public long getLDisplayLength(){
          return this.lDisplayLength;
       }locationPage()在做数据库查询前调用,在做rs结果集循环时:
    while (rs.next()){
               i++;
               count++;
               if((i>lStartRecord)&&(i<=(lStartRecord+lDisplayLength))){
               。
               。
               。
               }
    }后面的方法在jsp里调用就可以做分页处理了!