在改一个jsp/serlvet/javabean 的Project,在一个jsp中有多个submit 提交带着各种不同的条件去查询list 数据,然后再显示回这个jsp 页面.
我当前写了一个class 类,听说后面的步骤只要在jsp中声明对象,并传入相应的参数就ok 了,但是在jsp中怎么就不知道了.下面我贴出已写的代码希望能有人帮我把jsp部分补下.
[code="java"]import java.util.ArrayList;
/**
- 这个就是用来做分页的类
- @author zzy
- 创建时间:2009.3.19
-
*/
public class PagInation {//当前的页码数
private int currentPage ;
//每页显示多少行
private int showRow ;
//结果集的总行数
private int totalRecords ;
//结果集
private ArrayList objList ;/**
- 获取总页码数 (这是计算总页码数的一个不错的算法)
- @return int
- */ public int getTotalPages(){ return (this.totalRecords + this.showRow - 1)/this.showRow; }
/**
- 获取首页码数
- @return int
- */ public int getFristPageNumber(){ return 1 ; }
/**
- 获得尾页码数
- @return int
- */
public int getBottomPageNumber(){
return this.getTotalPages();
}
/**
- 获取上一页码数
- @return int
- */ public int getPerviousPageNumber(){ if(this.currentPage <= 1){ return 1; } return this.currentPage - 1 ; }
/**
- 获取下一页码数
- @return int
- */ public int getNextPageNumber(){ if(this.currentPage == this.getBottomPageNumber()){ return this.getBottomPageNumber() ; } return this.currentPage + 1 ; }
/**
- 获取当前页码数
- @return int
- */ public int getCurrentPage() { return currentPage; }
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}public int getShowRow() {
return showRow;
}public void setShowRow(int showRow) {
this.showRow = showRow;
}public int getTotalRecords() {
return totalRecords;
}public void setTotalRecords(int totalRecords) {
this.totalRecords = totalRecords;
}public ArrayList getObjList() {
return objList;
}public void setObjList(ArrayList objList) {
this.objList = objList;
}
}[/code]