这里是模板。
从TemplateEngine运行过程函数后,收到此错误org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as assignation sequence: "data=http://www.somesite.com" (template: "someFile.html" - line 5, col 2)
我尝试了几种不同的方法,并保持相同的结果。
<div class="someClass" th:id="${divId}">
<object class="someClass" type="application/pdf"
th:data="'|${url}|'">
<p>You don't have a PDF plugin for this browser.
<a th:href="@{|${url}|}">
Click here to download PDF file.
</a>
</p>
</object>
</div>
您打算将string
传递给th:当它期望expression
时。
更改此:
th:data="'|${url}|'"
为此:
th:data=${url}
记住要更改也作为字符串的其他元素。
您不需要大多数|
字符(因为使用文字替换在这里没有什么区别。您发布的代码应如下所示:
<div class="someClass" th:id="${divId}">
<object class="someClass" type="application/pdf" th:data="${url}">
<p>
You don't have a PDF plugin for this browser.
<a th:href="${url}">Click here to download PDF file.</a>
</p>
</object>
</div>
话虽这么说,您指示的错误通常是错误地使用th:with
引起的,并且由于我在您提供给我们的代码中看不到任何地方,所以我怀疑您是否已找到问题的根本原因。] >