- 9-10
@ResponseBody ??
값을 JSON으로 반환
https://ko.wikipedia.org/wiki/JSON
open api 배울거야
(/springWebRdsJpa02/src/main/resources/templates/board/detail.html)
function registReply(el){
$.ajax({
url : "/mybatis/boards/"+bno+"/reply",
success:function(){
}});
}
ajax는 url 필수! 결과값은 없어도 url은 있어야함
https://www.w3schools.com/jquery/ajax_ajax.asp
data : Specifies data to be sent to the server
- 10-11
type : Specifies the type of request. (GET or POST)
원래 두개밖에 못쓰는데 type: "DELETE" 가능
알아서 hidden _method 적용됨
https://www.w3schools.com/jquery/jquery_traversing_siblings.asp
https://www.w3schools.com/jquery/jquery_traversing_ancestors.asp
https://www.w3schools.com/jquery/jquery_traversing_descendants.asp
children() //바로아래
find() //아래로 찾기
function getReplies(){
//ajax로 댓글 갖고오는 함수
$.get("/mybatis/boards/"+bno+"/replies",
function(resp){ //성공시(success)
$("#display").html(resp);
// #display(id:display)의 위치에 요청한 url페이지가 보여짐(ajax(비동기))
}
); //위 ajax 함수와 동일
}
- 11-12
https://www.w3schools.com/jquery/html_val.asp
엔터코드 키 이벤트
- 12-1
mybatis를 활용한 댓글 paging
5개 출력 후 댓글이 더 있다면 더보기 버튼 생성
MySQL limit 기능 활용? MySQL에서만 사용 가능하니까
RowBounds 활용해보자
(/springWebRdsJpa02/src/main/java/com/green/nowon/service/board/MyReplyServiceProcess.java)
(/springWebRdsJpa02/src/main/java/com/green/nowon/domain/dao/MyReplyMapper.java)
(/springWebRdsJpa02/src/main/java/com/green/nowon/controller/MyReplyController.java)
@RequestParam
(/springWebRdsJpa02/src/main/java/com/green/nowon/service/board/MyReplyServiceProcess.java)
public void getList(long bno, int page, Model model) {
int size=3;
int offset=(page-1);
RowBounds rowBounds = new RowBounds(offset, size);
List<MyReply> replies = mapper.findByBnoAndRowBounds(bno, rowBounds);
model.addAttribute("list", replies);
}
- 3-4
댓글 페이징 기능 구현
Oauth2
- 4-5
인증과 권한
프로젝트명 : springWebSecurity01
https://spring.io/projects/spring-security
https://docs.spring.io/spring-security/reference/servlet/configuration/java.html
https://docs.spring.io/spring-security/reference/servlet/configuration/java.html#jc-httpsecurity
- 5-6
(/springWebSecurity01/src/main/java/com/green/nowon/security/SecurityConfig.java)
'개발일기' 카테고리의 다른 글
학원 수업 60일차 221115 (0) | 2023.04.27 |
---|---|
학원 수업 59일차 221114 (2) | 2023.04.27 |
학원 수업 58일차 221111 (0) | 2023.04.27 |
학원 수업 57일차 221110 (0) | 2023.04.27 |
학원 수업 55일차 221108 (0) | 2023.04.27 |
학원 수업 54일차 221107 (0) | 2023.04.27 |
학원 수업 53일차 221104 (0) | 2023.04.27 |
학원 수업 52일차 221103 (0) | 2023.04.27 |
댓글