728x90
- Thymeleaf의 가장 큰 장점
- natural templates
- html 파일을 서버사이드 렌더링을 하지않고 브라우저에 띄워도 정상적인 화면을 볼 수 있음
- natural templates
- th:text 란?
- model의 data라는 key값에 담아준 값을 출력한다.
@GetMapping(value = "/ex01")
public String thymeleafExample01(Model model){
model.addAttribute("data", "타임리프 예제 입니다.");
return "thymeleafEx/thymeleafEx01";
}
<body>
<p th:text="${data}">Hello Thymeleaf!!</p>
</body>
728x90
'Thymeleaf' 카테고리의 다른 글
SpringEL (0) | 2023.03.18 |
---|---|
th:switch, th:case 예제 (0) | 2022.02.15 |
th:each 예제 (0) | 2022.02.15 |
th:text DTO 활용 예제 (0) | 2022.02.14 |