Home > Java > javaTutorial > body text

Tags that may be used when java uses Thymeleaf

青灯夜游
Release: 2018-11-28 09:33:17
forward
2993 people have browsed it

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="&#39;javascript:more()&#39;" ></a>
Copy after login

2.Introduce CSS style

<link th:href="@{fore/css/public.css}" rel="stylesheet">
Copy after login

3.Introduce js file

<script th:src="@{fore/js/index.js}" type="text/javascript"></script>
Copy after login

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>
Copy after login

5. Import pictures

 <img th:src="@{fore/images/nav_icona.png}"/>
Copy after login

6. Page traversal

 <li th:each="item,i:${list}"></li>
Copy after login

7.if judgment and th:text value

<span th:if="${item.types==1}" style="color:green;">
    <span th:text=" ${item.coinNum}" ></span>
    <i class=&#39;fa fa-database&#39;></i>
</span>
Copy after login

8.Time type formatting

 <span th:text="${#dates.format(item.updateTime,&#39;yyyy/MM/dd HH:mm&#39;)}"></span>
Copy after login

9. Customize label attributes

 <p th:attr="_tId=${item.taskId}">
Copy after login

10. Get css style

<i class=&#39;fa fa-database&#39;></i>
Copy after login

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=&#39;fa fa-database&#39;></i>
Copy after login

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!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!