定义两个Vector,一个为储存查询所有记录的totalV,另一个储存当前页的记录currentPageV; 总的记录数:int totalSize = totalV.getSize(); 每页显示的记录数:int countPerPage; 总页数:int totalPageNum = totalSize/countPerPage;                  //如果总的记录数和每页记录数的余数大于零,                  //那么总的页数为他们的整除结果加一                  if (totalSize%countPerPage > 0 ){                     totalPageNum = totalSize/countPerPage + 1;                  } 当前的页数:pageNum;
                for (int j = 0;j<totalV.size();j++){                 //分页,根据当前的页数和每页显示的记录数从totalV中取出记录                 //往currentPageV中添加记录;                 //如果当前记录在(当前页码-1)*每页显示记录数(包括等于)                 //和 当前页码*每页显示记录数(不包括等于)之间的时候;                 //就属于该页的数据                 if ( (j >= (pageNum - 1) * countPerPage) && (j < pageNum * countPerPage)) {                    currentPageV.addElement(totalV.get(j));                 }                 //当currentPageV记录数等于每页显示记录数,                 //停止往currentPageV中添加记录                 if (currentPageV.size() == countPerPage) {                   break;                 }              } 那么,当前页中显示的记录,就是currentPageV中的记录。
   
 
  |