【报错】An error happened during template parsing (template: "class path resource [templates/hello1.html]")

页面显示:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Dec 06 23:26:03 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
An error happened during template parsing (template: "class path resource [templates/hello1.html]")
 
 

原因:
Thymeleaf样式不符合规范。
 
错误写法:
<p align="center" th:text="现在de时间是  ${now}">hihihi</p>

正确写法:

<p align="center" th:text="|现在de时间是  ${now}|">hihihi</p>
 

竖线不能漏掉!指的是文本替换。

另外,用+来连接字符串也是可以的。

另一种正确的写法:

<p align="center" th:text="'现在de时间是' +  ${now}">hihihi</p>

猜你喜欢

转载自www.cnblogs.com/christy99cc/p/12000196.html
今日推荐