1,变量表达式:
${session.user.name}以HTML标签的一个属性来表示;
<span th:text="${book.author.name}">
<li th:each="book:${books}">
2,选择或星号表达式
*{customer.name}用预先选择的对象来代替上下文变量容器(map)来执行;
被指定的object由th:object属性定义:
<div th:object="${book}">
...
<span th:text="*{title}">...</span>
...
</div>
3,文字国际化表达式
#{main.title}
#{message.entrycreated(${entryId})}
从一个外部文件获取区域文字信息(.properties),用Key索引Value,还可以提供一组参数(可选);
<table>
...
<th th:text="#{header.address.city}"></th>
<th th:text="#{header.address.country}"></th>
...
</table>
4,URL表达式
把一个有用的上下文或回话信息添加到URL,这个过程经常被叫做URL重写;
@{/order/list}
URL还可以设置参数:
@{/order/details(id=${orderId})}
相对路径:
@{../documents/report}
<form th:action="@{/createOrder}">
<a href="main.html" th:href="@{/main}">
Thymeleaf标准表达式语法
猜你喜欢
转载自blog.csdn.net/LittleMangoYX/article/details/81738371
今日推荐
周排行