<tr th:each="user : ${users}">
<td th:text="${user.id}">1</td>
<td th:text="${user.name}">张三</td>
<td th:text="${user.userName}">zhangsan</td>
<td th:text="${user.age}">20</td>
<td th:text="${user.sex} == 1 ? '男': '女'">男</td>
<td th:text="${#dates.format(user.birthday, 'yyyy-MM-dd')}">1980-02-30</td>
<td th:text="${user.note}">1</td>
</tr>
1、 ${}
: This is similar to el expression, but in fact is ognl grammar, and more powerful than el expression
2, th-
the instruction th-
is the use of custom properties Html5 achieved. If not H5, can be used data-th-
instead
th:each
: Similar to c:foreach
traverse the collection, but the syntax is more concise
th:text
: Statement label text, for example <td th-text='${user.id}'>1</td>
, if user.id has a value, overrides the default of 1, if there is no value, td default of 1 is displayed.
The reason for this is the thymeleaf capable of combining static and dynamic, template parsing failure does not affect the display of the page , because it will show the default value!