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

springboot的thymeleaf模板问题springboot的thymeleaf模板问题

时间:2018-04-23 18:47:55      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:项目   pid   html5   depend   mode   source   设置   div   HTML5标签   

springboot项目引入thymeleaf模板时,默认thymeleaf模板对html5标签是严格检查的。要实现非严格检查

1. 在项目中加NekoHTML库

在Maven中添加依赖

  1. <dependency>  
  2.     <groupId>net.sourceforge.nekohtml</groupId>  
  3.     <artifactId>nekohtml</artifactId>  
  4.     <version>1.9.22</version>  
  5. </dependency>  

2.更改thymeleaf设置

在配置文件application.properties中,对thymeleaf模板设置。

LEGACYHTML5需要搭配NekoHTML库才可用,实现thymeleaf非严格检查。

  1. #thymeleaf  
  2. spring.thymeleaf.encoding=UTF-8  
  3. spring.thymeleaf.suffix=.html  
  4. #默认严格检查  
  5. #spring.thymeleaf.mode=HTML5  
  6. #非严格检查  
  7. spring.thymeleaf.mode=LEGACYHTML5  

springboot的thymeleaf模板问题springboot的thymeleaf模板问题

标签:项目   pid   html5   depend   mode   source   设置   div   HTML5标签   

原文地址:https://www.cnblogs.com/y-blog/p/8920388.html

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