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
上一篇: 正则:校验名字,不严格校验手机号
下一篇: 设置运行jar包