How to check a boolean condition in EL?
Solution 1:
You can have a look at the EL (expression language) description here.
Both your code are correct, but I prefer the second one, as comparing a boolean to true
or false
is redundant.
For better readibility, you can also use the not
operator:
<c:if test="${not theBooleanVariable}">It's false!</c:if>
Solution 2:
Both works. Instead of ==
you can write eq