在使用springboot的过程中,使用thymeleaf作为模板文件,则要求HTML格式必须为严格的html5格式,必须有结束标签,否则会报错!
解决办法如下:
1、你可以使用严格的标签,也就是每个标签都有结束标签,这种可能比较麻烦
2、修改application.properties和新增nekohtml依赖
在application.properties中增加:
spring.thymeleaf.mode=LEGACYHTML5,即声明thymeleaf使用非严格的html。
maven依赖如下:
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>