thymeleaf 模板使用 之 解决因HTML标签未闭合引起的错误

一、修改thymeleaf属性配置

spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false

二、添加依赖(LEGACYHTML5需要搭配一个额外的库NekoHTML才可用)

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

 

posted @ 2018-01-24 15:53  ^梦幻星空^  阅读(235)  评论(0)    收藏  举报