Controller
@Controller
public class HelloController {
@GetMapping("hello-mvc")
public String helloMvc(@RequestParam("name") String name, Model model) {
**model.addAttribute("name", name);**
return "hello-template";
}
}
{“name” : name}
(key : value)View
<html xmlns:th="http://www.thymeleaf.org">
<body>
<p th:text="'hello ' + ${name}">hello! empty</p>
</body>
</html>
${name}
== Controller의 “name”