web项目之BBS流程解析(无servlet、filter)
public class PageModel<T> implements Serializable { <span style="white-space:pre"> </span>private List<T> list;<span style="white-space:pre"> </span>//泛型分页数据 <span style="white-space:pre"> </span>private Integer total=0;<span style="white-space:pre"> </span>//总的记录数 <span style="white-space:pre"> </span>private Integer currentpage=1;<span style="white-space:pre"> </span>//当前第几页 <span style="white-space:pre"> </span>private Integer pageSize=3;<span style="white-space:pre"> </span>//每页几条记录 <span style="white-space:pre"> </span>private Integer prepage=0;<span style="white-space:pre"> </span>//上一页 <span style="white-space:pre"> </span>private Integer nextpage=1;<span style="white-space:pre"> </span>//下一页 <span style="white-space:pre"> </span>private Integer totalPage=3;<span style="white-space:pre"> </span>//总页数 <span style="white-space:pre"> </span> <span style="white-space:pre"> </span>public void setList(List<T> list) { <span style="white-space:pre"> </span>this.list = list; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public List<T> getList() { <span style="white-space:pre"> </span>return list; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public void setTotal(Integer total) { <span style="white-space:pre"> </span>this.total = total; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public Integer getTotal() { <span style="white-space:pre"> </span>return total; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public void setCurrentpage(Integer currentpage) { <span style="white-space:pre"> </span>this.currentpage = currentpage; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public Integer getCurrentpage() { <span style="white-space:pre"> </span>return currentpage; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public void setPagesize(Integer pageSize) { <span style="white-space:pre"> </span>if(pageSize<0){ <span style="white-space:pre"> </span>this.pageSize=1; <span style="white-space:pre"> </span>}else{ <span style="white-space:pre"> </span>this.pageSize = pageSize; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public Integer getPagesize() { <span style="white-space:pre"> </span>return pageSize; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public Integer getPrepage() { <span style="white-space:pre"> </span>return prepage<=1?1:prepage-1; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public Integer getNextpage() { <span style="white-space:pre"> </span>return nextpage<=totalPage?totalPage:nextpage+1; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>public Integer getTotalpage() { <span style="white-space:pre"> </span>this.totalPage=this.total%this.pageSize==0?this.total/this.pageSize:this.total/this.pageSize+1; <span style="white-space:pre"> </span>return totalPage; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span> }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。