美文网首页
(七)SpringBoot模板引擎Freemaker、thyme

(七)SpringBoot模板引擎Freemaker、thyme

作者: 丛鹏 | 来源:发表于2022-07-03 11:03 被阅读0次

一、Freemaker

1.pom 文件添加

2.配置文件.properties添加相关配置信息

3.创建Controller

4.创建页面

二、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/

3.创建Controller

4.创建html

一定要以这种方式获取 <h1 th:text="${setting.name}">测试内容</h1>,而Freemaker 是这种方式获取的 <h1>${setting.domain} </h1> 记得一定要分清楚。

相关文章

网友评论

      本文标题:(七)SpringBoot模板引擎Freemaker、thyme

      本文链接:https://www.haomeiwen.com/subject/yymlbrtx.html