Thymeleaf模板引擎(取值+判断+循环)

(1)在pom.xml中导入依赖:

<!--添加thymeleaf依赖-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

在html文件上方添加Thymeleaf的头文件:

<html lang="en" xmlns:th="http://www.thymeleaf.org">

(2)取值:

(3)判断(if或者switch)

日期按照特定的格式显示:

(4)循环:

发布了15 篇原创文章 · 获赞 32 · 访问量 2155

猜你喜欢

转载自blog.csdn.net/qq_39182939/article/details/104562252