๐[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 ํ ํ๋ฆฟ ์์ง ์ด๋ฏธ์ง