HTML中按下一页或者上一页的时候有如下代码:nextPagePreviousPage然后在Action中作如下处理:
String currentPage = request。getParameter("currentPage");
。
getSession();
EmployeeForm employeeForm = (EmployeeForm) form;
String queryString = null;
String queryCon = null;
String action = employeeForm。
getAction();
List list = new ArrayList();
PageBean pb = null;
EmployeeDao employeeDao = new EmployeeDao();
if(action == null || action。
equals("null")){
int totalRows = employeeDao。getTotalRows();
pb = new PageBean(totalRows);
session。removeAttribute("page");
queryString = employeeForm。
getQueryString();
queryCon = employeeForm。getQueryCon();
session。setAttribute("queryString",queryString);
session。setAttribute("queryCon",queryCon);
list = employeeDao。
getAllEmployee(queryString, queryCon,
String。valueOf(pb。getPageStartRow()),
String。valueOf(pb。getPageRecorders()));
}else if(action。
equals("nextPage")){
queryString = (String)session。getAttribute("queryString");
queryCon = (String)session。getAttribute("queryCon");
employeeForm。
setQueryString(queryString);
employeeForm。setQueryCon(queryCon);
pb = (PageBean)session。getAttribute("page");
pb。nextPage();
list = employeeDao。
getAllEmployee(queryString, queryCon,
String。valueOf(pb。getPageStartRow()),
String。valueOf(pb。getPageRecorders()));
}else if(action。
equals("previousPage")){
queryString = (String)session。getAttribute("queryString");
queryCon = (String)session。getAttribute("queryCon");
employeeForm。
setQueryString(queryString);
employeeForm。setQueryCon(queryCon);
pb = (PageBean)session。getAttribute("page");
pb。previousPage();
list = employeeDao。
getAllEmployee(queryString, queryCon,
String。valueOf(pb。getPageStartRow()),。