springmvc6 @requestMapping 에러 처리(1) 클래스부에 requestMapping은 하단의 중복을 없애 주는 것을 위해서 되는거라고 알고있엇고 간단하게 테스트하기 위해서 아래를 만들었었다 //잘돌아가나 확인할려고 //@Controller == component @RestController @Component @RequestMapping("/user") public class User { //@GetMapping("/A") 이거를 지우니 왜 /user에서 안되는거지 ? @ResponseBody @RequestMapping public String findUser(Model model) { model.addAttribute("add", "ad"); return "ok"; } } 에러 1 클래스부에만 requestMappingm을 달아주면 findUse.. 2021. 8. 8. controller, model, view model, view, controller client의 요청이 오면 서버의 역할의 하는 springboot는 controller, model, view의 과정을 거친다 controller : client요청을 처리한다 , ex : GETMapping("/hi") -> getMapping을 통해서 client요청을 받는다 model : controller한테 데이터를 받아서 view를 전달 controller에서 return 되는 값이 viewPage의 이름이다 보여줄 페이지의 값은 model을 통해서 등록된다return 값이 templates/..로 된다 ex : model.addAttribute("username", kcj3054) 이런식으로 username 에 kcj3054값을 넣는 형식 2021. 8. 1. 이전 1 2 다음