变量表达式
语法:${...}
<span th:text="${book.author.name}">
消息表达式
#{...}
<th th:text="#{header.address.city}">...</th>
选择(*)表达式
*{...}
<div th:object="${book}">
...
<span th:text="*{title}">...</span><!-- 表示book的title -->
</div>
链接表达式
@{...}<!-- 主要用于连接url -->
<a th:href="@{../domain/user}">...</a><!-- 相对地址链接 -->
<a th:href="@{~/user/delete}">...</a><!-- 服务器相对地址 -->
<!-- 和协议相对(就像绝对url,但浏览器将在显示的页面中使用相同的HTTP或HTTPS协议) -->
<a th:href="@{//static.mycompany.com/res/initial}">...</a>
<a th:href="@{http://www.baidu.com/main}">...</a><!-- 绝对地址链
学习ThymeLeaf基本用法的一点笔记
最新推荐文章于 2023-09-24 09:18:32 发布