Thymeleaf common th tag

Thymeleaf

Keyword Features Case
th:id Replace id <input th:id="'xxx' + ${collect.id}"/>
th:text Text Replacement <p th:text="${collect.description}">description</p>
th: utext Supports html text replacement <p th:utext="${htmlcontent}">content</p>
th:object Replacing objects <div th:object="${session.user}">
th:value Property assignment <input th:value = "${user.name}" />
th:with Variable assignment operator <div th:with="isEvens = ${prodStat.count}%2 == 0"></div>
th:style Setting styles <div th:style="'display:' + @{(${sitrue} ? 'none' : 'inline-block')} + ''"></div>
th:onclick Click event <td th:onclick = "'getCollect()'"></td>
th:each Property assignment <tr th:each = "user,userStat:${users}">
th:if Analyzing conditions <a th:if = "${userId == collect.userId}">
th:unless And th: if the opposite determination <a th:href="@{/login} th:unless=${session.user != null}">Login</a>
th:href link address <a th:href="@{/login}" th:unless=${session.user != null}>Login</a>
th:switch Multiplexer with th: case Use <div th:switch="${user.role}">
th:fragment th: a branch of the switch <p th:case = "'admin'">User is an administrator</p>
th:includ Layout tab, introduced to replace the contents of a file <head th:include="layout :: htmlhead" th:with="title='xx'"></head>
th:replace Layout tab, introduced to replace the entire tag file <div th:replace="fragments/header :: title"></div>
th:selectd selected in the selection marquee th:selected="(${xxx.id} == ${configObj.dd})"
th:src Picture categories introduced address <img class="img-responsive" alt="App Logo" th:src="@{/img/logo.png}" />
th:inline Js script can use variable definitions <script type="text/javascript" th:inline="javascript">
th:action Address form submission <form action="subscribe.html" th:action="@{/subscribe}">
th:remove Delete a property <tr th:remove="all"> 1.all:删除包含标签和所有的孩子。2.body:不包含标记删除,但删除其所有的孩子。3.tag:包含标记的删除,但不删除它的孩子。4.all-but-first:删除所有包含标签的孩子,除了第一个。5.none:什么也不做。这个值是有用的动态评估。
th:attr Label attribute set, a plurality of attributes may be separated by commas 比如 th:attr="src=@{/image/aa.jpg},title=#{logo}",此标签不太优雅,一般用的比较少。

Guess you like

Origin www.cnblogs.com/liabin/p/11640152.html