【报错】An error happened during template parsing (template: &am

时间:2021-08-01 18:24:12

页面显示:

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]")    

 

【报错】An error happened during template parsing (template: &am

 

 

 

原因: 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>