Home > Spring > πŸƒ[Spring] MVC와 ν…œν”Œλ¦Ώ 엔진.

πŸƒ[Spring] MVC와 ν…œν”Œλ¦Ώ 엔진.
Spring Framework

πŸƒ[Spring] MVC와 ν…œν”Œλ¦Ώ 엔진.

  • MVC
    • Model
    • View
    • Controller
  • Controller
@Controller
public class HelloController {
    
    @GetMapping("hello-mvc")
    public String helloMvc(@RequestParam("name") String name, Model model) {
        model.addAttribute("name", name);
        return "hello-template";
    }
}
  • View
<html xmlns:th="htt[://www.thymeleaf.org">
<body>
<p th:text="'hello ' + ${name}">hello! empty</p>
</body>
</html>
  • μ‹€ν–‰
    • http://localhost:8080/hello-mvc?name=spring

  • MVC ν…œν”Œλ¦Ώ 엔진 이미지