1 <table> 2 ... 3 <th th:text="#{header.address.city}">...</th> 4 5 <th th:text="#{header.address.country}">...</th> 6 ... 7 </table>
<div th:object="${book}"> 取book這個全文對象做爲變量,這個變量有多個屬性 ... <span th:text="*{title}">...</span> 如今取book這個當前對象的title這個屬性 ... </div>
與變量表達式的區別:它們是在當前選擇的對象而不是整個上下文變量映射上執行。html
1.連接表達式能夠是相對的,這種狀況下,應用程序上下文將不會做爲URL的前綴, <a th:href="@{../documents/report} ">...</a> 2.也能夠是服務器相對(一樣,沒有應用程序上下文前綴), <a th:href="@{~/contents/main}">...</a> 3.和協議相對(就像絕對URL,但瀏覽器將使用在顯示的頁面中使用的相同的HTTP或HTTPS協議) <a th:href="@{//static.mycompany.com/res/initial}">...</a> 4.固然Link表達式也能夠是絕對的: <a th:=href="@{http://www.mycompany.com/main}">...</a>
1 <html> 2 ... 3 <body> 4 <div th:fragement="copy"> 5 ©2018<a href="http://www.baiasnjdsad.com">sada</a> 6 7 </div> 8 </body> 9 ...
10 </html>
<body> ... <div th:insert="~{footer::copy}"></div> </body>
1 <div th:switch="${user.role}"> 2 <p th:case=" 'admin' "> User is an admin </p> 3 <p th:case="#{roles.manager}"> User is an manager</p> 4 <p th:case=" '*' "> User is some other </p> 5 </div>
1 <div id="copy-section"> 2 © 2017 <a href="www.baidu.com">baidu.com</a> 3 </div>
<body> ... <div th:insert="~{footer::#copy-section}">...</div> ... </body>