Advertisement
Ravuthz

JSP - Pagination Action

Apr 3rd, 2015
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.21 KB | None | 0 0
  1. JexPTCommonUtil util    = JexPTCommonUtil.getInstace(request, response);
  2.    
  3.     Dvut_homeIn input = (Dvut_homeIn)util.getInputDomain();
  4.     Dvut_homeOut result = (Dvut_homeOut)util.createResultDomain();
  5.  
  6.     // STDY IDO Connection
  7.     JexConnection idoCon = JexIDOManager.createIDOConnection();
  8.  
  9.     DVUT_LISTUSERIn idoIn1 = (DVUT_LISTUSERIn) util.createIDOData(DVUT_LISTUSERIn.class);
  10.  
  11.     JexDomainUtil.copyDomain(input,  idoIn1);
  12.    
  13.     /* Pagination Scope */
  14.     JexDataList idoOut1 = null;
  15.        
  16.     PAGINATIONS pagination = input.getPaginations();
  17.        
  18.     if(pagination != null) {
  19.         // JexDomainUtil.setIDOPageInfo(idoIn1, NumberUtils.toInt(pagination.getPageNo()),                                          NumberUtils.toInt(pagination.getPageSze()));
  20.         JexDomainUtil.setIDOPageInfo(idoIn1, Integer.parseInt(pagination.getPageNo()), Integer.parseInt(pagination.getPageSze()));
  21.     }
  22.    
  23.     int totalRows = JexDomainUtil.getResultCount(idoCon.executeList(idoIn1));
  24.     // int totalPages = (int)Math.ceil(totalRows / NumberUtils.toDouble(pagination.getPageSze()));
  25.  
  26.     int totalPages = (int)Math.ceil(totalRows / Double.parseDouble(pagination.getPageSze()));
  27.  
  28.     pagination.setTotalRows(totalRows+"");
  29.     pagination.setTotalPages(totalPages+"");
  30.  
  31.     /* End Pagination Scope */
  32.  
  33.     idoOut1 = idoCon.executeList(idoIn1);
  34.  
  35.     // 도메인 에러 검증
  36.     if (JexDomainUtil.isError(idoOut1)) {
  37.         if (util.getLogger().isDebug()) util.getLogger().debug("Error Code   ::"+JexDomainUtil.getErrorCode     (idoOut1));
  38.         if (util.getLogger().isDebug()) util.getLogger().debug("Error Message::"+JexDomainUtil.getErrorMessage  (idoOut1));
  39.  
  40.         // 아래는 에러 처리 로직. 업무에 맞게 아래의 방법 등을 활용하여 에러처리가 가능하다.
  41.         // 01. Throws 방식 : JCT호출에서 사용하기 편리한 방식.
  42.         // throw new JexBIZException(idoOut1);
  43.         // 02. Result Type 선택 방식 : STRUTS의 형태와 같이 Result Type에 따라 분기할 페이지 선택
  44.         // util.setResult(result,"E");
  45.     }
  46.  
  47.     JexRecordDataList<Dvut_home_ALL_USERS> recList1 = new JexRecordDataList<Dvut_home_ALL_USERS>();
  48.     JexDomainUtil.changeList(idoOut1, recList1, Dvut_home_ALL_USERS.class);
  49.     result.setAllUsers(recList1);
  50.     result.setPaginations(pagination);
  51.     util.setResult(result, "default");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement