thymeleaf常用标签

th:action

表单常用

<form id="form" th:action="@{/doSave}">...</form>

th:each

list常用

<div th:each="policy,rowStat:${policyList}">

th:field

最后生成的html中会生成name和id

<form id="login-form" th:action="@{/doSave}" th:object="${userDto}">...

<input type="text" value="" th:field="*{username}"></input>

<input type="text" value="" th:field="*{passwd}"></input>

</form>

th:href

<a th:href="@{/policy/doSave}"></a>

th:id

id属性

<div th:id ="${policyId}"></div>

th:text

文本显示

<td class="text" th:text="${policyContent}" ></td>

th:value

value属性

<option th:value="${color}">red</option>

<input  id="policyId" type="hidden" th:value="${policyId}" />

th:fragment

th:include

th: replace

源文件

<div th: fragment="Copy" >

© 2011 The Good Thymes Virtual Grocery

</div>

引入使用

<div th: include=" /templates/footer : : Copy" ></div>

<div th: replace=" /templates/footer : : Copy" ></div>
posted @ 2021-01-16 11:10  vaen  阅读(230)  评论(0)    收藏  举报