SpringBoot创建Thymeleaf

发布时间 2023-09-10 23:31:46作者: wwh99

1.pom.xml导入依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

 

2.thymelef的默认配置文件

springboot工程默认有一个templates文件夹,所有的html页面都放这个文件夹里。

 

3.新建一个controller

 

4.创建html文件,写上命名空间 xmlns:th="http://www.thymeleaf.org"