0
点赞
收藏
分享

微信扫一扫

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

狐沐说 2022-01-28 阅读 44

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