Search code examples
javathymeleaf

Thymeleaf th:block not working any more


I have written a block of code in Thymeleaf:

<th:block th:if="${i.mid} > ${yesterday.tableRateModel.rates[e.index].mid}">
                        <i class="glyphicon glyphicon-arrow-up"></i>
                    </th:block>
                    <th:block th:if="${i.mid} == ${yesterday.tableRateModel.rates[e.index].mid}">
                        <i class="glyphicon glyphicon-resize-small"></i>
                    </th:block>
                    <th:block th:if="${i.mid} < ${yesterday.tableRateModel.rates[e.index].mid}">
                        <i class="glyphicon glyphicon-arrow-down"></i>
                    </th:block>

And in this case I get error like: org.xml.sax.SAXParseException: The value of attribute "th:if" associated with an element type "th:block" must not contain the '<' character.

But when I comment the last th:block everything works properly. What is wrong?

The problem is with <


Solution

  • Use this:

    &lt; for <
    &gt; for >
    &le; for <=
    &ge; for >=