springboot的thymeleaf模板問題springboot的thymeleaf模板問題
阿新 • • 發佈:2018-04-23
fix pid source pen html5標簽 需要 嚴格 thymeleaf cef
springboot項目引入thymeleaf模板時,默認thymeleaf模板對html5標簽是嚴格檢查的。要實現非嚴格檢查
1. 在項目中加NekoHTML庫
在Maven中添加依賴
- <dependency>
- <groupId>net.sourceforge.nekohtml</groupId>
- <artifactId>nekohtml</artifactId>
- <version>1.9.22</version>
- </dependency>
2.更改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
springboot的thymeleaf模板問題springboot的thymeleaf模板問題