목록spring (40)
알고보면코딩천재
@Param이란? -Mybatis의 SQL 문장에 (데이터베이스에) 다수의 변수를 전달할 때는 전달되는 변수들에 @Param 어노테이션을 붙여주어 각 변수를 구분할 수 있다록 한다. 변수를 한개만 전달할때는 상관없지만, 다수의 변수를 전달할때는 꼭 @Param을 써준다. 안써봤는데 오류나더라. Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Thu Sep 08 14:58:51 KST 2022 There was an unexpected error (type=Internal Server Error, status=500). nested exception is..
검색바 ui main.jsp Search 번호 게시글제목 작성자이름 ${boards.id } ${boards.title } ${boards.username } Prev ${num} Next get은 데이터를 body에 못담으니까 주소에 담아간다 쿼리스트링-PK아니니까 당연하죠? ?page=0&keyword=스프링 boards.xml 쿼리문 작성 검색기능을 1. 동적 쿼리로 작성한다. 2. 쿼리문 하나 더 만든다 SELECT totalCount, totalPage, currentPage, decode(currentPage, 0, 1, 0) first, decode(currentPage, totalPage-1, 1, 0) last FROM ( select count(*) totalCount, ceil(cou..
회원정보수정 둘 다 postmapping -header.jsp (링크) -users/updateForm.jsp (1)세션가져오기 (2)변경 (3)수정 (4)세션동기화 password, email 수정 updateDto만들기 (import 주의) 회원탈퇴 postmappin /users/{id}/delete 탈퇴하고나면 로그아웃 되어야 함 (1) 삭제 (2) 세션 무효화(session invalidated) (3) 글 같이 삭제 혹은 FK 삭제 @GetMapping 은 select할때만 써라 delete할때 쓰면 안되는 이유 뭘까? 하이퍼링크로 뚫을 수 있다 ! -> 꿀잼ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ!! 근데 어차피 GetMapping 안쓰니까 이제 못뚫음. 낄낄..ㅎㅎ 공격 시나리오 정리할 것 XSS --..
stateful한척 하는게 session response bw선만 유지한다 일방적으로 push가능 updateForm.jsp 만들기 (wirteForm과 같다) 원래는 put요청이라 form으로 못한다. 지금은 자스를 안배워서 일단 post로 배우는 것 글쓰기는 CV패턴 업데이트는 MVC패턴 ${boards.content } 수정완료 model에 담아서 title, content들고 와야한다. required, maxlength restful api 자원에 접근하는 주소를 설계하는 방식-프로토콜이라서 무조건 따라할 필요가 없다. (프로젝트할때 공부해볼것) 말이되게(잘 읽히게) 설계하면 된다. BoardsController @GetMapping("/boards/{id}/updateForm") public ..

delete 쿼리문 짜기 SELECT totalCount, totalPage, currentPage, decode(currentPage, 0, 1, 0) first, decode(currentPage, totalPage-1, 1, 0) last FROM ( select count(*) totalCount, ceil(count(*)/3) totalPage, #{page} currentPage, 0 first, 0 last FROM boards ) INSERT INTO boards(id, title, content, usersId, createdAt) VALUES(boards_seq.nextval, #{title}, #{content}, #{usersId}, sysdate) SELECT id, title, ..
DB에 insert하고 나서는 commit을 해줘야지 !!!! 페이지 링크 수 10개까지만 나오게 하기 번호 게시글제목 작성자이름 ${boards.id } ${boards.title } ${boards.username } 다음페이지 totalCount:${paging.totalCount } totalPage:${paging.totalPage } currentPage:${paging.currentPage } isLast:${paging.last } isFirst:${paging.first } Prev ${num} Next 첫번째 페이지에서는 prev 비활성화 두번째 페이지에서부터는 prev 활성화 마찬가지로 next도 비활성화/활성화 시킬 것 삼항연산자로 번호 게시글제목 작성자이름 ${boards.id }..
테스트 할때 매개변수 값 given 테스트 하는 것 when SELECT totalCount, totalPage, currentPage, decode(currentPage, 0, 1, 0) first, decode(currentPage, totalPage-1, 1, 0) last FROM ( select count(*) totalCount, ceil(count(*)/10) totalPage, 0 currentPage, 0 first, 0 last FROM boards ); 이거를 내가 짤 줄 알아야 한다. SELECT totalCount, totalPage, currentPage, decode(currentPage, 0, 1, 0) first, decode(currentPage, totalPage-1, ..
PK로 하면 안된다.\ rownum으로 만들어내는 것 select * from ( select rownum no, b.* from boards b order by id desc ) where no > =1 and no 10 ->20 얘만 바뀌면 된다. boards.xml INSERT INTO boards(id, title, content, usersId, createdAt) VALUES(boards_seq.nextval, #{title}, #{content}, #{usersId}, sysdate) SELECT b.id, b.title, u.username FROM boards b INNER JOIN users u ON b.usersId = u.id ORDER BY b.id DESC offset #{sta..