日期:2014-05-18  浏览次数:20749 次

谁来帮我看看,我这样写错在哪了
写了一个DAO+分页辅助类,但有些问题:
点击最后一页时总是显示java.lang.IndexOutOfBoundsException:   Index:   13,   Size:   13

数据库表中目前共有13条记录,就是找不出越界在哪里。
哪位帮我看看

===============

主要代码如下
//=======分页辅助类Pager.java=======

package   com.saro.demo.util;

public   class   Pager   {
  private   int   currentpage;//当前页码
  private   int   pagesize=3;//每页显示记录数
  private   int   totalsize;//总的记录数
  private   int   totalpage;//总的页数
 
  private   boolean   hasFrist;//判断首页   判断   当前页是否是第1页就可以
  private   boolean   hasPervious;//上一页   如果有首页肯定有上一页   反之
  private   boolean   hasNext;//下一页   如果有尾页肯定有下一页
  private   boolean   hasLast;//尾页     判断是否为最后一页
  public   Pager(int   curentpage,int   totalsize)
  {
    this.currentpage   =   curentpage;
    this.totalsize   =   totalsize;
  }
  public   int   getCurrentpage()   {
    return   currentpage;
  }
  public   void   setCurrentpage(int   currentpage)   {
    this.currentpage   =   currentpage;
  }
  public   boolean   isHasFrist()   {
    if(currentpage==1)
      return   false;
   
    return   true;
  }
  public   void   setHasFrist(boolean   hasFrist)   {
    this.hasFrist   =   hasFrist;
  }
  public   boolean   isHasLast()   {
    if(currentpage==getTotalpage())
      return   false;
    return   true;
  }
  public   void   setHasLast(boolean   hasLast)   {
    this.hasLast   =   hasLast;
  }
  public   boolean   isHasNext()   {
    if(isHasLast())
      return   true;
    return   false;
  }
  public   void   setHasNext(boolean   hasNext)   {
    this.hasNext   =   hasNext;
  }
  public   boolean   isHasPervious()   {
    if(isHasFrist())
      return   true;
   
    return   false;
  }
  public   void   setHasPervious(boolean   hasPervious)   {
    this.hasPervious   =   hasPervious;
  }
  public   int   getPagesize()   {
    return   pagesize;
  }
  public   void   setPagesize(int   pagesize)   {
    this.pagesize   =   pagesize;
  }
  //总页数就是用总记录数/页面最大记录数  
  //最后   磨一个就是多出的记录也做一页加算进总页数
  public   int   getTotalpage()   {
    totalpage   =   totalsize   /   pagesize;
    if(totalsize%pagesize!=0)
  {
totalpage++;
  }
    return   totalpage;
  }
  public   void