Reputation: 389
When using Thymeleaf, I am trying to show a certain image conditionally. This works properly
<img th:if="*{ score < 20 and score > 0}" src="images/Fast-Track-No1.jpg" th:href="@{/images/Fast-Track-No1.jpg}" style = "width: 450px;" alt=""/>
However, this does not work.. Only changing the > to &ge
<img th:if="*{ score < 20 and score ≥ 0}" src="images/Fast-Track-No1.jpg" th:href="@{/images/Fast-Track-No1.jpg}" style = "width: 450px;" alt=""/>
I receive an error that states "missing expected character '&'"
All I did was change the > to &ge..
I followed the documentation here: http://www.thymeleaf.org/doc/html/Using-Thymeleaf.html#comparators-and-equality
I have done the check with ge first and there is no difference. I have also tried as the doc shows without the ampersand as such
*{score} ge; 0"
and it still fails and throws errors. According to my pom.xml file I am using ThymeLeaf 2.1.2.RELEASE.
Thanks,
Upvotes: 4
Views: 2266
Reputation: 389
Thanks to Jim on the Thymeleaf Forum.. There is no xml Entity for >= or <=. This fixed it.
<img th:if="*{ score < 20 and score >= 0}" src="images/Fast-Track-No1.jpg" th:href="@{/images/Fast-Track-No1.jpg}" style = "width: 450px;" alt=""/>
Upvotes: 3