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

Reply via email to