Possible bug with OGNL string comparison
Gautam Newalkar <[email protected]>
| Newsgroups | gmane.comp.java.open-symphony.webwork |
|---|---|
| Message-ID | <15927967.1147244037154.JavaMail.os-j2ee@opensymphony01.managed.contegix.com> |
Hi All,
I have a String variable in my aciton stack called 'colour' and I want to test if it equals "R". So I do the following:
[code]
<ww:if test="colour == 'R'">
...
</ww:if>
[/code]
But this doesn't seem to work. My guess is that the OGNL parser converts 'R' to a char, and hence the comparison equates to false.
After (hours of) debugging this, the only solution i can think of is:
[code]
<ww:if test="colour == ('' + 'R')">
...
</ww:if>
[/code]
Which is basically concatinating the character to an empty string (which results in a string itself).
~gautam
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=30267&messageID=58551#58551
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]