Hi,

you should consider comparing strings with the equals() method  :

"invalid".equals(#parameters.status)



Cordialement,
Pierre Lavignotte
Ingénieur Conception & Développement
http://pierre.lavignotte.googlepages.com


On Fri, Apr 17, 2009 at 8:01 PM, Terry Gardner <terry.gard...@sun.com>wrote:

> try <s:if test='%{#parameters.status == "invalid"}'>
>
>
> On Apr 17, 2009, at 1:58 PM, Russell Neufeld wrote:
>
>  Hi all,
>>
>>  I'm still coming up the learning curve on Struts2, and I've come across
>> something I can't explain.  Hopefully you guys out there can help me
>> understand this.  I have a request parameter "status" set to "invalid" which
>> I'd like to access from within a JSP.  If I use the following line:
>>
>> <s:property value="#parameters.status"/>
>>
>>  I see "invalid" written to the HTML, which is what I expect.  However, if
>> I try to use that in an expression, like this:
>>
>> <s:if test='#parameters.status == "invalid"'>
>>
>>  this always evaluates to false.  Similarly, this:
>>
>> <s:property value="#parameters.status == 'invalid'"/>
>>
>>  prints out "false" to the HTML output.  However, if I do the following:
>>
>> <s:set var="foo">bar</s:set>
>> <s:property value="#foo == 'bar'"/>
>>
>>  that prints out "true" to the HTML output.  Yet this:
>>
>> <s:set var="status" value="#parameters.status"/>
>> <s:property value="#status == 'invalid'"/>
>>
>>  prints out "false" to the HTML output.
>>
>>  Can someone help me understand this behaviour please?  Any ideas on how
>> to compare a request parameter to a string literal?  Thanks,
>>
>>     Russ
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to