home
자바
home
🎃

RowBounds (페이징처리)

// 마이바티스에서는 페이징 처리를 위해 RowBounds라는 클래스를 제공 // * offset : 조회시 몇 개의 게시글을 건너뛰고 조회할지에 대한 값 // ex) boardLimit : 5 // offset limit // currentPage = 1 1~5 "0개"의 게시글 건너뛰고 "5개" 조회 // currentPage = 2 6~10 "5개"의 게시글 건너뛰고 "5개" 조회 // currentPage = 3 11~15 "10개"의 게시글 건너뛰고 "5개" 조회 int offset = (pi.getCurrentPage() - 1) * pi.getBoardLimit(); int limit = pi.getBoardLimit(); RowBounds rowBounds = new RowBounds(offset, limit);
Java
복사