I have two strings that i need to compare, but even if they have the same values or different , it always enters the statement...
<c:when test="#{bean.name1 != bean.name2}">
fields that are supposed to appear _only_ when name1 is different from name2
</c:when>
The problem is that you probably did not wrap the when in a choose tag.
if you have:
<c:choose>
<c:when test="${bean.name1 != bean.name2}">
fields that are supposed to appear _only_ when name1 is different from name2
</c:when>
</c:choose>
It will work
Should it be ?
<c:if test="#{bean.name1 != bean.name2}">
// code
</c:if>
EDIT : <c:when>
is supposed to be inside <c:choose>
. Cannot ask why, that is just the syntax. It is like asking why if
will not work in place of switch
in C/C++/Java. They are just different animals.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With