如题,模板一直报错:
An error happened during template parsing (template: “class path resource [templates/index.html]”)
尝试:
- 在index.html中将thymeleaf模板注释掉,只剩一般的html,可以正常运行,那就应该是thymeleaf出了问题
- 尝试加入最简单的thymeleaf语句,
<span th:text="hello world"></span>
,打印hello world字符串,报相同的错误
解决办法:
将尝试语句改成了, <span th:text="'hello world'"></span>
,字符串另外加上单引号括起来。
如此证明我的环境配置没有问题,就是thymeleaf语法写错了。