如何识别标准方言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