studyplan
@PathVariable 예제코드 , 값 받기 본문
답 :
@PathVariable 주소창 옆에 들어온 숫자를 받는다는 뜻
@GetMapping("/content/{boardNo}")
public String content(@PathVariable Long boardNo, Model model,
HttpServletResponse response, HttpServletRequest request , @ModelAttribute("p") Page page) {
System.out.println("\n\n========================\n\n");
log.info("controller request /board/content GET! - {}", boardNo);
Board board = boardService.findOneService(boardNo, response, request );
log.info("return data - {}", board);
model.addAttribute("b", board);
// model.addAttribute("p",page);
System.out.println("\n\n========================\n\n");
return "board/board-detail";
}
@GetMapping 안의 값은
이런 빨간 박스 안 = 주소창에 나온 값이고
{boardNo} 는
/content/ 옆에 숫자를 말한다
결론
저 주소창에 127 이라는 숫자는
long boardNo 라는 뜻이다 !!
'스프링' 카테고리의 다른 글
mybatis delete 문 오류 (0) | 2022.07.26 |
---|---|
nested exception is org.apache.ibatis.executor.ExecutorException 오류 resultMap (0) | 2022.07.26 |
mybatis 에서 ReflectionException 문제 ! (0) | 2022.07.21 |
mybatis 에서 ExecutorException 오류 (0) | 2022.07.21 |
spring boot 게시판 만들기 8. @Controller // 조건부 쿠키 만들기 ~ @RequestMapping() , @pathvariable , @ModelAttribute() redirect: 사용 (0) | 2022.07.21 |
Comments