You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

<ww:if test="#myObj.myString == 'A'">
Why doesn't this work when myString is equal to A?
</ww:if>

OGNL will interpret 'A' as a char type and not a string. Simple solution - flip the double and single quotes.

<ww:if test='#myObj.myString == "A"'>
This works!
</ww:if>

Alternatively, you can escape the double quotes in the String:

<ww:if test="#myObj.myString == \"A\"">
This works!
</ww:if>
  • No labels