一、Freemaker
1.pom 文件添加
![](https://img.haomeiwen.com/i7317292/5bbd70f4d49bc947.png)
2.配置文件.properties添加相关配置信息
![](https://img.haomeiwen.com/i7317292/29dd35ca20e13852.png)
3.创建Controller
![](https://img.haomeiwen.com/i7317292/7ad1e0c62f931b73.png)
4.创建页面
![](https://img.haomeiwen.com/i7317292/e72d6c47aafda6fb.png)
二、thymeleaf
1.pom添加
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
2.配置文件.properties添加相关配置信息
web.upload-path=****
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,classpath:/test/,file:${web.upload-path},classpath:/templates/
![](https://img.haomeiwen.com/i7317292/b738a54a31699f14.png)
3.创建Controller
![](https://img.haomeiwen.com/i7317292/afeac002fa64fdee.png)
4.创建html
一定要以这种方式获取 <h1 th:text="${setting.name}">测试内容</h1>,而Freemaker 是这种方式获取的 <h1>${setting.domain} </h1> 记得一定要分清楚。
![](https://img.haomeiwen.com/i7317292/aae7409327b17de4.png)
网友评论