thymeleaf模板對沒有結束符的HTML5標籤解析出錯的解決辦法

xjwtt發表於2018-01-06

在application.properties檔案中新增

spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false  
spring.thymeleaf.mode =LEGACYHTML5
複製程式碼
LEGACYHTML5需要搭配一個額外的庫NekoHTML才可用

專案中使用的構建工具是Maven新增如下的依賴即可完成: pom.xml 中引入

<dependency>  
       <groupId>net.sourceforge.nekohtml</groupId>  
       <artifactId>nekohtml</artifactId>  
       <version>1.9.22</version>  
</dependency>  
複製程式碼

相關文章