struts分頁(yè)算法如何實(shí)現?

5年前 (2020-03-06)閱讀383回復0
訪(fǎng)客
訪(fǎng)客
  • 管理員
  • 發(fā)消息
  • 注冊排名3
  • 經(jīng)驗值65770
  • 級別管理員
  • 主題13152
  • 回復5
樓主

??HTML中按下一頁(yè)或者上一頁(yè)的時(shí)候有如下代碼:nextPagePreviousPage然后在A(yíng)ction中作如下處理:

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()),。

0
0
收藏0
回帖

struts分頁(yè)算法如何實(shí)現? 期待您的回復!

取消
載入表情清單……
載入顏色清單……
插入網(wǎng)絡(luò )圖片

取消確定

圖片上傳中
編輯器信息
提示信息