【文件属性】:
文件名称:ssh 万能类分页系统,可复用!
文件大小:9.65MB
文件格式:RAR
更新时间:2017-04-08 15:07:07
ssh js javaBean 分页
动态实现分页,可复用,类分页,ssh
package com.djh.action.web;
import java.io.Serializable;
import java.util.List;
public class PageBean implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private List list;//要返回的页面记录列表
private int allRow;//总记录数
private int totalPage;//总页数
private int currentPage;//当前页
private int pageSize;//每页显示的条数
public List getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
public int getAllRow() {
return allRow;
}
public void setAllRow(int allRow) {
this.allRow = allRow;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
/*
* 计算总页数,静态方法,供外部直接通过类名调用
*/
public static int countTotalPage(final int pageSize, final int allRow){
int totalPage = allRow%pageSize == 0? allRow/pageSize:allRow/pageSize + 1;
return totalPage;
}
/*
* 计算当前页开始记录
*/
public static int countOffset(final int pageSize, final int currentPage){
int offset = pageSize*(currentPage - 1);
return offset;
}
/*
* 计算当前页,默认为第一页
*/
public static int countCurrentPage(int page){
final int curPage = (page==0 ? 1:page);
return curPage;
}
@SuppressWarnings("unused")
private boolean isFirstPage;//是否为第一页
@SuppressWarnings("unused")
private boolean isLastPage;//是否为最后一页
@SuppressWarnings("unused")
private boolean hasPreviousPage;//是否有前一页
@SuppressWarnings("unused")
private boolean hasNextPage;//是否有下一页
public void init(){
this.isFirstPage = isFirstPage();
this.isLastPage = isLastPage();
this.hasPreviousPage = isHasPreviousPage();
this.hasNextPage = isHasNextPage();
}
public boolean isFirstPage(){
return currentPage == 1;
}
public boolean isLastPage(){
return currentPage == totalPage;
}
public boolean isHasPreviousPage()
{
return currentPage != 1;
}
public boolean isHasNextPage()
{
return currentPage != totalPage;
}
}
【文件预览】:
数据库说明.txt
SSHPage
----.project(1KB)
----.mymetadata(294B)
----src()
--------struts.xml(843B)
--------hibernate.cfg.xml(983B)
--------com()
--------.struts.mex(76B)
----WebRoot()
--------WEB-INF()
--------CSS()
--------error.jsp(831B)
--------index.jsp(965B)
--------showstudent.jsp(1KB)
--------META-INF()
--------JS()
----.myeclipse()
----.settings()
--------org.eclipse.jdt.core.prefs(330B)
----.classpath(2KB)