当前位置: 技术问答>java相关
各位大虾,谁有完整的分页实现程序 ,最好是javabean的?
来源: 互联网 发布时间:2015-07-29
本文导语: 各位大虾,谁有完整的分页实现程序 ,最好是javabean的?程序代码含 javabean代码。急用!!小弟先谢了 | package com.xingtong.cms.web; import java.util.*; import com.xingtong.cms.db.*; /** * Title: ...
各位大虾,谁有完整的分页实现程序 ,最好是javabean的?程序代码含 javabean代码。急用!!小弟先谢了
|
package com.xingtong.cms.web;
import java.util.*;
import com.xingtong.cms.db.*;
/**
* Title: Contract Managment System
* Description: For Xinanjiang electronic power factory
* Copyright: Copyright (c) 2002
* Company: Sino Tele.
* @author Zhangyx
* @version 1.0
*/
public class MultiPageList {
private ArrayList alList = null;
private int pageSize = 15;
private int totalPage = 0;
private int currentPage = 0;
/**
方法名称:MultiPageList
输入:ArrayList
输出:
说明:无参数构建器,默认记录条数为15
**/
public MultiPageList(ArrayList alList)
{
this.alList = alList;
if(alList != null && alList.size() > 0)
{
totalPage = alList.size() / pageSize;
if(alList.size() % pageSize > 0)
totalPage++;
currentPage = 1;
}
}
/**
方法名称:MultiPageList
输入:ArrayList,int
输出:
说明:带参数的构建器,记录数为pagesize
**/
public MultiPageList(ArrayList alList, int pageSize)
{
this.alList = alList;
this.pageSize = pageSize;
if(alList != null && alList.size() > 0)
{
totalPage = alList.size() / pageSize;
if(alList.size() % pageSize > 0)
totalPage++;
currentPage = 1;
}
}
/**
方法名称:getCurrentPage
输入:
输出: int
说明:得到当前页数
**/
public int getCurrentPage()
{
return currentPage;
}
/**
方法名称:setCurrentPage
输入:int
输出:无
说明:设置当前页数
**/
public void setCurrentPage(int currentPage)
{
if(currentPage > 0 && currentPage 0)
totalPage++;
}
/**
方法名称:getTotalPage
输入:
输出: int
说明:得到所有的页数
**/
public int getTotalPage()
{
return totalPage;
}
public boolean hasNext()
{
if(currentPage == totalPage)
return false;
return true;
}
public boolean hasPrevious()
{
if(currentPage
import java.util.*;
import com.xingtong.cms.db.*;
/**
* Title: Contract Managment System
* Description: For Xinanjiang electronic power factory
* Copyright: Copyright (c) 2002
* Company: Sino Tele.
* @author Zhangyx
* @version 1.0
*/
public class MultiPageList {
private ArrayList alList = null;
private int pageSize = 15;
private int totalPage = 0;
private int currentPage = 0;
/**
方法名称:MultiPageList
输入:ArrayList
输出:
说明:无参数构建器,默认记录条数为15
**/
public MultiPageList(ArrayList alList)
{
this.alList = alList;
if(alList != null && alList.size() > 0)
{
totalPage = alList.size() / pageSize;
if(alList.size() % pageSize > 0)
totalPage++;
currentPage = 1;
}
}
/**
方法名称:MultiPageList
输入:ArrayList,int
输出:
说明:带参数的构建器,记录数为pagesize
**/
public MultiPageList(ArrayList alList, int pageSize)
{
this.alList = alList;
this.pageSize = pageSize;
if(alList != null && alList.size() > 0)
{
totalPage = alList.size() / pageSize;
if(alList.size() % pageSize > 0)
totalPage++;
currentPage = 1;
}
}
/**
方法名称:getCurrentPage
输入:
输出: int
说明:得到当前页数
**/
public int getCurrentPage()
{
return currentPage;
}
/**
方法名称:setCurrentPage
输入:int
输出:无
说明:设置当前页数
**/
public void setCurrentPage(int currentPage)
{
if(currentPage > 0 && currentPage 0)
totalPage++;
}
/**
方法名称:getTotalPage
输入:
输出: int
说明:得到所有的页数
**/
public int getTotalPage()
{
return totalPage;
}
public boolean hasNext()
{
if(currentPage == totalPage)
return false;
return true;
}
public boolean hasPrevious()
{
if(currentPage