How to have multiple condition in an th:if tag using thymeleaf
In my opinion, a better and more maintainable solution could be to write the evaluation code in a proper class.
class Evaluator{private int value;....public boolean isBounded() { return value < 49 && value > 29;}
then in thymeleaf, call the function:
<p th:if="${evaluator.isBounded()} ...
Some benefits:
- Cleaner template.
- Control in java code.
- Isolation. More complex evaluations could be written without changing the template.
I hope this helps.