@GetMapping

· Spring
Spring MVC에 GET, POST 방식에 동일 이름 커맨드 객체 사용하는 방법을 알아보겠습니다. form 태그를 사용하려면 커맨드 객체가 반드시 존재해야 합니다. 폼 표시 요청이 왔을 때에도 커맨드 객체를 생성해서 모델에 저장해야 합니다. RegisterController 클래스의 handleStep2() 메서드는 다음과 같이 Model에 직접 객체를 추가합니다. @PostMapping("/register/step2")public String handleStep2(@RequestParam(value = "agree", defaultValue = "false") Boolean agree, Model model) { if(!agree) { return "register/step1"; ..
· Spring
이번 포스팅에서는 클라이언트의 요청을 알맞게 처리할 컨트롤러와 처리 결과를 보여줄 JSP 코드를 통해 실습해 보도록 하겠습니다. 컨트롤러 구현 package chap09; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @Controller public class HelloController { @GetMapping("/hello") public String hello(Model mode..
runnnerDevHong
'@GetMapping' 태그의 글 목록