百里香的错误

时间:2013-01-26 10:11:01

标签: template-engine thymeleaf

这是我的模板示例:

<tr th:with="negNumber = ${myNum < 0}">
...
</tr>

我收到以下异常消息:

Caused by: org.xml.sax.SAXParseException: The value of attribute "th:if" associated with an element type "null" must not contain the '<' character.

有什么想法吗?

2 个答案:

答案 0 :(得分:1)

XML建立&lt;和&gt;不应在属性值中使用符号,因此应将其替换为&lt;&gt;

示例:

th:if="${prodStat.count} gt; 1”   

请注意,这些运算符存在文本别名:gt(&gt;),lt(&lt;),ge(&gt; =)和le(&lt; =)。也是eq (==)和neq(!=)。

我希望这可以解决你的问题......

答案 1 :(得分:0)

<,>,“和&符号应在标记属性内转义。 使用&lt;解决您的问题。

相关问题