thymeleaf模板实现极速ssc源码出售html5标签的非严格检查

最近在springboot项目引入thymeleaf模板时,极速ssc源码出售【企鹅21717-93408】使用非严格标签时,运行会报错。默认thymeleaf模板对html5标签是严格检查的。

二、在项目中加NekoHTML库
在Maven中添加依赖

<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>

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

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

#thymeleaf
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.suffix=.html
#默认严格检查
#spring.thymeleaf.mode=HTML5
#非严格检查
spring.thymeleaf.mode=LEGACYHTML5

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章