关键词: j2ee页面struts寻呼鲤鱼手套
//*
package cn.eshore.user.util;
公共类页{
私密int current page=1; //当前页数
公共int总页面=0; //总页数
私密int pagesize=0;//每页显示数
私密int总rows=0; //总数据数
私密int startnum=0; //开始记录
私密int next page=0; //下一页
私密int previous page=0; //上一页
私密性booleanhasnextpage=false; //有下一页吗
私密性booleanhaspreviouspage=false; //有上一页吗
公共页面(int pagesize,int currentPage,int totalRows ) {
this.pageSize=pageSize;
this.currentPage=currentPage;
this.totalRows=totalRows;
if () totalrows%pagesize )==0) {
totalPages=totalRows/pageSize;
} else {
totalPages=totalRows/pageSize 1;
}
if (当前页面=总页面) {
hasNextPage=false;
} else {
hasNextPage=true;
}
if (当前页面=1) {
hasPreviousPage=false;
} else {
hasPreviousPage=true;
}
nextPage=currentPage 1;
下一页=总页(if ) {
下一页=总页;
}
预优页=current page-1;
if (预览页面=1) {
预览页面=1;
}
}
公共布尔型ishasnextpage () ) )。
返回主机页面;
}
公共布尔型ishaspreviouspage (
返回间隙;
}
//*
公共插入获取下一页
返回下一页;
}
//*
publicvoidsetnextpage (下一页)。
this.nextPage=nextPage;
}
//*
公共int getpreviouspage (
返回预览页面;
}
//*
公共语音预置空间(intpreviouspage )。
this.previousPage=previousPage;
}
//*
公共int get current page (
返回当前页面;
}
//*
publicvoidsetcurrentpage (内当前页)。
this.currentPage=currentPage;
}
//*
公共int getpagesize
返回页面;
}
//*
公共语音设置页面大小(int pagesize )。
this.pageSize=pageSize;
}
//*
公共插入获取总页面
返回总页面;
}
//*
publicvoidsettotalpages (内总页) {
this.totalPages=totalPages;
}
//*
公共int gettotalrows (
返回总行;
}
//*
公共语音设置(Inttotalrows )。
this.totalRows=totalRows;
}
//*
publicvoidsethasnextpage (布尔型hasnextpage ) )。
this.hasNextPage=hasNextPage;
}
//*
publicvoidsethaspreviouspage (布尔haspreviouspage )。
this.haspreviouspage=haspreviouspage;
}
//*
公共int get startnum
返回启动;
}
//*
publicvoidsetstartnum (内部开始)。
this.startNum=startNum;
}
}
如果使用的是struts,则在调用此PageBean寻呼鲤鱼手套之前,必须获取要寻呼的数据的总记录数,然后实例化此PageBean。 然后,可以使用get方法获得所需的值。
打包测试;
import cn.e shore.user.util.page bean;
公共课堂测试扩展的大船{
.
孝顺八宝粥,心跳加速的蜜蜂
.
int pageSize=5;
string pageid=request.getparameter (' pageid );
if (pageid==null|() ) ) 0
}
int current page=integer.parseint (pageid;
//从服务层获得的用户总记录数
inttotalrows=userservice.gettotalrows (;
.
}
}