【发布时间】:2018-10-07 06:59:56
【问题描述】:
在模板header我有
<head th:fragment="common_header(title)">
<title th:replace="${title}">Default title</title>
<meta charset="utf-8" />
...
</head>
我尝试在参数中使用文字:
<head th:replace="~{header::common_header(title='This should be real title')}">
<title>Just for template's sake...</title>
<meta charset="utf-8" />
...
</head>
但我得到的只是
org.thymeleaf.exceptions.TemplateInputException: Error resolving template "This should be real title", template might not exist or might not be accessible by any of the configured Template Resolvers (template: "header" - line 4, col 9)
我做错了什么?使用_(无操作令牌)产生Default title(如预期)
【问题讨论】:
-
/template文件夹中有您的header模板吗?header文件的第 4 行是什么? -
@BennettDams 是的,我有。第四行是
<title th:replace="${title}">Default title</title>
标签: spring templates spring-boot thymeleaf