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

页面显示:

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: "class path resource [templates/hello1

 

 

 

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

 

上一篇:我应该如何在Django中按项目类别组织项目列表?


下一篇:《C++ Templates》深入模板基础(一)——模板参数问题(重点待补全)