Spring MVC - 게시판 페이징 처리
SQL 부분 - 오라클 기준
1. 전체 데이터 가져오기 (게시물 번호 컬럼을 이용해서 내림차순 정렬 하였다)
1 2 3 4 | select bno, title, writer, name, regdate, viewcnt from board b, member m where b.writer = m.userid order by bno desc; | cs |
2. 정렬된 데이터에 rownum을 활용해 행번호를 부여
1 2 3 4 5 6 7 | select rownum as rn, A.* from (select bno, title, writer, name, regdate, viewcnt from board b, member m where b.writer = m.userid order by bno desc ) A; | cs |
3. 데이터에서 between 활용해 일정 데이터만 가져오기
1 2 3 4 5 6 7 8 9 10 11 | select * from (select rownum as rn, A.* from (select bno, title, writer, name, regdate, viewcnt from board b, member m where b.writer = m.userid order by bno desc ) A ) where rn between 1 and 10; | cs |
PageMaker VO 클래스
'Certification > Spring(2V0-72.22, SCP)' 카테고리의 다른 글
What is the concept of AOP? Which problem does it solve? What is a cross cutting concern? (0) | 2021.11.06 |
---|---|
What is dependency injection and what are the advantages of using it? (0) | 2021.11.03 |
iBatis Mapper Null 값 치환하기 (0) | 2018.10.25 |
Controller @RequestMapping 리턴 타입 (0) | 2018.10.04 |
View에 데이터 전송을 위한 Model 개념 (0) | 2018.10.03 |