💡 이 글은 골든래빗 《스프링 부트 3 백엔드 개발자 되기 - 자바 편》의 07장 써머리입니다.
${…} : 변수의 값 표현식
// ${session.user.name}
<div th:object = "${book}$>
...
<span th:text = "*{title}">...</span>
...
</div>
Globals.OsType = UNIX
Globals.DbType = mysql
<table>
...
<th th:text="#{Globals.OsType}">...</th>
<th th:text="#{Globals.DbType}">...</th>
</table>
<a th:href=”@{/order/list}”>…</a>
→ <a href=”/allchan/order/list”>…</a>
<a href="/allchan/order/list;jsessionid=23fa31abd41ea093">...</a>
<a th:href=”@{/order/details(id=${orderId}, type=${orderType})}”>…</a>
<a href="/allchan/order/details?id=23&type=online">...</a>
th:text=${emplyr.name}
th:each=”emplyr : ${emplyrs}”
th:if = “${emplyr.position} == leader”
th:unless=”${emplyr.orgnzt} == sales”
th:href=”@{/emplyrs(id = {emplyr.id})}”
th:with=”name = ${emplyr.name}”
th:object = “${person}”
@GetMapping("/thymeleaf/example")
public String thymeleafExample(Model model) {
Person exampleMember = new Member();
exampleMember.setId(1L);
exampleMember.setName("탄야");
exampleMember.setAge(31);
exampleMember.setHobbies(List.of("사야","은섬"));
model.addAttribute("member", exampleMember();
model.addAttribute("today", LocalDate.now());
return "example";
}