뷰 템플릿에 적용하기
@Controller
public class ConverterController {
@GetMapping("/converter-view")
public String converterView(Model model) {
model.addAttribute("number", 10000);
model.addAttribute("ipPort", new IpPort("127.0.0.1", 8080));
return "converter-view";
}
}<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<ul>
<li>${number}:<span th:text="${number}"></span></li>
<li>${{number}}:<span th:text="${{number}}"></span></li>
<li>${ipPort}:<span th:text="${ipPort}"></span></li>
<li>${{ipPort}}:<span th:text="${{ipPort}}"></span></li>
</ul>
</body>
</html>${number}: 10000
${{number}}: 10000
${ipPort}: hello.typeconverter.type.IpPort@59cb0946
${{ipPort}}: 127.0.0.1:8080
Form에 적용하기
Last updated