由于想在以前搭建的项目使用(以前使用jsp),注释掉jsp相关之后,反正都不能行得通。还是新建整合吧,idea新建springboot可以自行百度。
首先引入Thymeleaf (创建的时候也可以勾选,我没有)
**
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
**
properties文件配置
spring.thymeleaf.prefix=classpath:/templates/
####后缀
spring.thymeleaf.suffix=.html
#####模板格式
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.cache=false
html文件默认放置在template文件夹
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>