Search code examples
template-enginethymeleaf

thymeleaf errors


Here is my template sample:

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

And I got the following exception message:

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

Any idea?


Solution

  • XML establishes that the < and > symbols should not be used in attribute values, and so they should be substituted by &lt;and &gt;

    Example:

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

    Note that textual aliases exist for these operators: gt(>), lt(<), ge(>=) and le(<=). Also eq (==) and neq(!=).

    I hope this should solve your problem....