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

狐沐说

关注

阅读 44

2022-01-28

 一、修改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>

精彩评论(0)

0 0 举报