码迷,mamicode.com
首页 > 编程语言 > 详细

Spring Boot入门——thymeleaf模板使用

时间:2017-06-13 00:02:54      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:nbsp   group   spring   缓存   步骤   pat   ase   资源文件   lease   

使用步骤

1、在pom.xml中引入thymeleaf

    <!-- thymeleaf插件 -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
        <version>1.5.3.RELEASE</version>
    </dependency>    

2、关闭thymeleaf缓存

  创建application.properties资源文件

<!-- 关闭thymeleaf缓存 -->
spring.thymeleaf.cache=false

#spring.thymeleaf.prefix=classpath:/templates/  

#spring.thymeleaf.suffix=.html 

#spring.thymeleaf.mode=HTML5

#spring.thymeleaf.encoding=UTF-8  

# ;charset=<encoding> is added 

#spring.thymeleaf.content-type=text/html 

3、编写thymeleaf模板文件

4、编写模板请求controller

Spring Boot入门——thymeleaf模板使用

标签:nbsp   group   spring   缓存   步骤   pat   ase   资源文件   lease   

原文地址:http://www.cnblogs.com/studyDetail/p/6995458.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!