The content of this article is to introduce the tags that may be used when Java uses Thymeleaf. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
1. onclick event
<a th:onclick="'javascript:more()'" ></a>
2.Introduce CSS style
<link th:href="@{fore/css/public.css}" rel="stylesheet">
3.Introduce js file
<script th:src="@{fore/js/index.js}" type="text/javascript"></script>
4. Introduce header information and tail information
Note: Introduce header and tail information on the html (folder)/public.html page
<!-- 导航 头部信息--> <!-- 导航 头部信息引入 --> <div class="nav-container" th:fragment="topper"> <div th:replace="html/public :: topper"> </div> <!-- 底部信息 --> <!-- 底部信息引入 --> <div class="att-bottom" th:fragment="footer"> <div th:replace="html/public :: footer"></div>
5. Import pictures
<img th:src="@{fore/images/nav_icona.png}"/>
6. Page traversal
<li th:each="item,i:${list}"></li>
7.if judgment and th:text value
<span th:if="${item.types==1}" style="color:green;"> <span th:text=" ${item.coinNum}" ></span> <i class='fa fa-database'></i> </span>
8.Time type formatting
<span th:text="${#dates.format(item.updateTime,'yyyy/MM/dd HH:mm')}"></span>
9. Customize label attributes
<p th:attr="_tId=${item.taskId}">
10. Get css style
<i class='fa fa-database'></i>
Note: Get <i class='fa fa-database'>i> When setting the icon style, the tag cannot be written in the value of th:text . Another '' tag does not belong to the same value as the (as shown below)
<i class='fa fa-database'></i>
This way you can get <i class=' fa fa-database'>i> Icon style
The above is the detailed content of Tags that may be used when java uses Thymeleaf. For more information, please follow other related articles on the PHP Chinese website!