首页 > 编程语言 > 详细

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

时间:2018-04-23 17:43:19      阅读:165      评论:0      收藏:0      [点我收藏+]

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模板问题

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

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