게시물의 총 수

ResultSet 사용시

rs.last();

int totalRecode = rs.getRow();

 

레코드 사이즈

recordSize = 10;

한페이지당 보여줄 게시물의 갯수

 

Vector 사용시

int totalRecode = vector.size();

 

현제 보고 있는 페이지

currentPage = 1;

if(request.getParameter("currentPage") != null)

{

     currentPage = request.getParameter("currentPage");

}

 

현재 보고 있는 페이지 번호.

 

게시물에 따른 총 페이지 수

int totalPage = (int)Math.ceil((float)totalRecode/(float)recordSize);

 

게시물 번호

int num = totalRecode - ((currentPage-1) * recordSize);

 

블럭 사이즈

blockSize = 5;

 

네비게이션에 보여질 페이지 갯수

ex ) ◁ [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] ▷

 

네비게이션

시작 페이지 : int firstPage = currentPage - ((currentPage-1)%blockSize);
마지막 페이지 : int lastPage = firstPage + (blockSize-1);

 

네비게이션에 나오는 첫번째 페이지와 마지막 페이지

1, 2, 3, 4, 5 일때 1과 5

6, 7, 8, 9, 10 일때 6과 10

 

커서 포지션

int curPos = recordSize*(currentPage-1);

: 네비게이션의 각 페이지 별로 rs 객체 또는 백터의 커서 처음 시작 위치


+ Recent posts