MVC와 템플릿 엔진
Controller
@GetMapping("hello-mvc")
public String helloMvc(@RequestParam("name") String name, Model model) {
model.addAttribute("name", name);
return "hello-template";
}
View
hello! empty
--> http://localhost:8080/hello-mvc?name=spring~~
name 값에 넘겨주는 파라미터에 따라 ${name} 값이 바뀐다.
<html xmlns:th="http://www.thymeleaf.org">
<body>
<p th:text="'hello ' + ${name}">hello! empty</p>
</body>