欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

springboot整合thymeleaf严格校验html5,前台页面[[@{/}]]报错

程序员文章站 2022-03-02 19:01:43
...

**

标题:springboot整合thymeleaf严格校验html5

**

编程遇到一个问题
在使用[[@{/}]]的时候
idea一直报错
identifier or string literal or numeric literal expected
springboot项目明明引入了thymeleaf的依赖,页面加载不出来
后台报错标签未正常结束
最后经大佬指导,发现是
thymeleaf对html5校验过于严格
在pom.xml里添加依赖

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

版本可加

在application.properties添加

pring.thymeleaf.mode=LEGACYHTML5

然后运行,尽管在idea里面还是报错,但是能正常运行了!

参考了一部分这里的资料,蟹蟹!
https://www.jianshu.com/p/1acc384a7c4c

相关标签: java spring boot