일반적인 HTML 처럼 <!-- 와 --> 사이의 구문을 주석으로 처리한다.
타임리프 처리 후에도 템플릿에 남아 있다.
[컨트롤러 메서드]
@GetMapping("ch0807/home0101")
public String home0101(Model model) {
model.addAttribute("msg", "Hello world!");
return "ch0807/home0101";
}
[뷰 파일]
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<!-- User info follows -->
<h1 th:text="${msg}">greeting</h1>
</body>
</html>
[응답 화면]
<!-- / 와 /--> 사이의 구문을 주석으로 처리한다.
타임리프 처리 할 때 삭제된다.
[컨트롤러 메서드]
@GetMapping("ch0807/home0201")
public String home0201(Model model) {
model.addAttribute("msg", "Hello world!");
return "ch0807/home0201";
}
[뷰 파일]
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<!--/* This code will be removed at Thymeleaf parsing time! */-->
<h1 th:text="${msg}">greeting</h1>
</body>
</html>
[응답 화면]