如何識別標準方言javascript
<span th:text="..."> <span data-th-text="...">
<span th:text="${book.author.name}">
<table> ... <th th:text"#{header.address.city}"">...</th> ... </table>
<div th:object="${book}"> ... <span th:text="*{title}">...</span> ... </div>
與變量表達式區別:他們是在當前選擇的對象而不彷佛整個上下文變量映射上執行css
連接表達式能夠是相對的,在這種狀況下,應用程序上下文將不會做爲URL的前綴。html
<a th:href="@{../documents/report}">...</a>
也能夠是服務器相對(一樣,沒有應用程序上下文前綴):java
<a th:href="@{~/documents/report}">...</a>
和協議相對(就像絕對URL,但瀏覽器將使用在顯示的頁面中使用的相同的HTTP或HTTPS協議):web
<a th:href="@{//static.mycompany.com/res/initial}">...</a>
固然,Link表達式能夠是絕對的:瀏覽器
<a th:href="@{http://www.mycompany.com/main}">...</a>
<p> Now you are looking at a <span th:text = "'working web application'">template file</span> </p>
<p>The year is <span th:text="2013">1492</span>.</p>
<div th:if="${user.isAdmin()} == false">...</div>
<div th:if="${variable.something} == null">...
<ul class="pagination" data-th-if="${page.totalPages le 7}" >
<option data-th-each="i : ${#arrays.toIntegerArray({5,10,40,100})}" data-th-calue="${i}" data-th-selected="${i eq page.size}" data-th-text="${i}"></option>
<tr th:class="${row.even} ? 'even' : 'odd'"> ... </tr>
<span th:text"${user.name} ? : _">no user authenticated<?span>
<form action="subscribe.html" th:attr="action=@{/subscribe}"> <fieldset> <input type="text" name="email" /> <input type="submit" value="Subscribe!" th:attr="value=#{subscribe.submit}" /> </fieldset> <form>
<form action="subscribe.html" th:action="@{/subscribe}"> <fieldset> <input type="text" name="email" /> <input type="submit" value="Subscribe!" th:value="#{subscribe.submit}" /> </fieldset> <form>
<input type="checkbox" name="active" th:checked="${user.active}">
<li th:each="book : ${books}" th:text="${book.title}">En las Orillas del Sar</li>
<table> <tr> <th>NAME</th> <th>PRICE</th> <th>IN STOCK</th> </tr> <tr th:each="prod,iterStat : ${pords}" th:class="${iterStat.odd? 'odd'}"> <td th:text="${prod.name}">Onions</td> <td th:text="${prod.price}">2.41</td> <td th:text="${prod.inStock}? #{true} : #{false}">Yes</td> </tr> </table>
<a href="comments.html" th:href="@{/product/comments(prodId=${prod.id})}" th:if="${not #lists.isEmpty(prod.comments)}">view</a>
<a href="comments.html" th:href="@{/product/comments(prodId=${prod.id})}" th:unless="${#lists.isEmpty(prod.comments)}">view</a>
<div th:switch="${user.role}"> <p th:case="'admin'">User is an administrator</p> <p th:case="#{roles.manager}">User is a manager</p> <p th:case="*">User is some other thing</p> </div>
<!DOCTYPE html> <body> <div th:fragment="copy"> ©2017<a href="https://waylau.com">waulau.com</a> </div> </body> </html>
<body> ... <div th:insert="~{footer :: copy}"></div> </body>
... <div id="copy-section"> ©2017<a href="https://waylau.com">waulau.com</a> </div> ...
<body> ... <div th:insert="~{footer :: #copy-section}"></div> </body>
th:include相似於th:insert,但不插入片斷它只插入此片斷的內容。(3.x版本後,再也不推薦使用)服務器
<!--/*--> <div> you can see me onlu before Thymeleaf processes me! </div> <!--*/-->
<span>hello!</span> <!--/*/ <div th:text="${...}"> ... </div> /*/--> <span>goodbye!</span>
<p>The message is "[(${msg})]"</p>
<p th:inline="none">A double array looks like this : [[1,2,3],[4,5]]!</p>
<script th:inline="javascript"> ... var username = /*[[${session.uer.name}]]*/ "Gertrud Kiwifruit" ... </script>
##### CSS內聯
<style th:inline="css"> .[[${classname}]] { text-align: [[${align}]]; } </style>
session
application:用於檢索application/servlet上下文屬性app