首页 > 编程语言 > 详细

Spring Boot入门——thymeleaf模板使用

时间:2017-06-12 23:40:50      阅读:532      评论:0      收藏:0      [点我收藏+]

使用步骤

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模板使用

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!