1 / 8

Paging

Paging. 배상 준. 1.Paging 변수. int startPage =1; // 시작 페이지 || 현재 페이지 int curPage =1; // 현재 페이지의 첫글 번호 int curendPage =0; // 현재페이지의 끝글 번호 int countPerPage =1; // 페이지당 글 수 int totalCount =0; // 전체 글수 int totalPage =0; // 전체 페이지수 마지막 페이지 //------------ 여러 블록이라면

zelia
Télécharger la présentation

Paging

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Paging 배상준

  2. 1.Paging 변수 • intstartPage=1; //시작 페이지 ||현재 페이지 • intcurPage=1; //현재 페이지의 첫글 번호 • intcurendPage=0; //현재페이지의 끝글 번호 • intcountPerPage=1; //페이지당 글 수 • inttotalCount=0; //전체 글수 • inttotalPage=0; //전체 페이지수 마지막 페이지 • //------------여러 블록이라면 • intstartBlock=1; //시작 블록 || 현재 블록 • intcountPerBlock=2; //한 블록 당 블록 수 • inttotalBlock=0; //전체 블록 수 • intcurBlockPage=0; //현재 블록의 첫 번째 페이지 • intcurendBlock=0; //현재 블록의 마지막 페이지 • intlastBlockPage=0; //마지막 페이지 =totalPage • intlastBlockStartPage=0; //전 블록의 시작 페이지

  3. 2. Paging without block-1 • startPage=3; //시작 페이지 • totalCount=28; //전체 글수 • countPerPage=5; //페이지당 글 수 일때 • curPage=(3-1)*5+1; //현재 페이지 첫글 번호 (startPage-1)*countPerPage+1 • curendPage=(3*5); //현재페이지의 끝글번호 (startPage*countPerPage) • totalPage=Math.ceil((28*1.0)/5) Math.ceil (totalCount*1.0)/totalCount)

  4. 2. Paging without block-2 • totalPage= (int)Math.ceil(totalCount*1.0/countPerPage); • curPage=totalPage==1?1: (startPage-1)*countPerPage+1; • curendPage=(totalPage!=startPage)? (startPage)*countPerPage: (totalCount%countPerPage==0?(startPage)*countPerPage:(curPage-1)+totalCount%countPerPage);

  5. 2-1.Paging 예 • public Vector<ChatterBoardDto> getChatBoardList(intsnum, intenums) { String strQuery = "select SEQCHAT, ID, TITLE, CONTENT, MDATE from ( select row_number() over (order by seqchatdesc) rn, SEQCHAT, ID, TITLE, CONTENT, MDATE from CHATTERBOARD) where rn between ? and ?

  6. 3. Paging with block-1 • startBlock=2; //시작 블록 totalCount=28; //전체 글수 • countPerBlock=2; • totalBlock=Math.ceil((6*1.0)/2)=3 (totalPage*1.0)/countPerBlock • curBlockPage=(2-1)*2+1=3; (startBlock-1)*countPerBlock+1 • curendBlock=(2*2)=4; (startBlock*countPerBlock) • lastBlockPage=Math.ceil((28*1.0)/5) (totalCount*1.0)/countPerPage; //마지막 페이지 • lastBlockStartPage=(2-2); (curBlockPage-countPerBlock)

  7. 3. Paging with block-2 • totalBlock=(int)Math.ceil(totalCount*1.0/(countPerPage*countPerBlock)); • curBlockPage=totalBlock==1?1: (startBlock-1)*countPerBlock+1; //마지막 블록 • lastBlockPage=(int)Math.ceil(totalCount*1.0/countPerPage); //totalPage //수정 2009.6.23 마지막 블록이라면 --- • curendBlock=(totalBlock!=(int)Math.ceil(curBlockPage*1.0/countPerBlock))?(startBlock*countPerBlock):lastBlockPage//총페이지수;

  8. 1 2 블록의 첫페이지=1, 마지막 페이지=2, 현재 블록=1 • 3 4 (2번째 블록-1)*한블록당 수(2)+1 =curBlockPage • 5 6 (3번째 블록)*한블록당수=curEndBlock • 페이지 수=6개 • 블록 수=3개 • 4 5 6 블록의 첫페이지=4, 마지막 페이지=6 • 7 8 9

More Related