Reputation: 17
I am currently trying to hide specific elements, if the creditUser in my app has credit less than the costs of a specific dish. (It's kind of a dish ordering system, just for training purposes) And I cannot figure out how to set up the thymeleaf condition, to make it work...
I've tried all kinds of solutions, but all I can find on the internet is something like this: th:if="*{ score < 20 and score >= 0}"
my current version looks like this:
<td ><a th:if="${creditUser.credit} > ${dish.small}" class="btn btn-success" th:href="@{/order/orderDish/(creditUserId=${creditUser.id},dishId=${dish.dishId},delId=${dish.delId},dishName=${dish.name},price=${dish.small})}" th:text="${dish.small}">Bestellen</a></td>
Now I don't get any error messages, but the element is also not showing up. Any suggestions on how to compare a value in thymeleaf to another value? (The creditUser is passed it is just not shown in the code part and the solution works with fixed values like creditUser.credit > 1)
Upvotes: 0
Views: 782
Reputation: 616
Everything should be inside the same braces:
th:if="${creditUser.credit > dish.small}"
Upvotes: 2