struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Schneider" <schne...@gmail.com>
Subject Re: [s2] String comparison with OGNL
Date Tue, 23 Jan 2007 20:06:37 GMT
On our webwork project, we're successfully using this (copied directly from
the JSP):

<ww:if test="caseType == 'SG'">

where caseType is an bean property (from a list of beans being iterated
over) that will be "SG" if the 'if' tag contents should be rendered.
However, I think this might be a case of an interned string, so it would be
better to use .equals which should work equally well.  (We are using .equals
in other places, but only to check if the string is blank)
Tom

On 1/23/07, Wesley Wannemacher <WesW@doubleatrailer.com> wrote:
>
> When I read your message, it occurred to me that OGNL couldn't know what
> type `addrType' was because my Action is only a stub. #parameters is a
> magical variable containing all of the request parameters, so I hadn't
> thought of making getters/setters on my Action before.
>
> So, I added a getAddrType() and setAddrType(String) then tried again.
>
> I went through the whole gambit of syntaxes and I still can't find one
> that
> works.
>
> If I'm using the correct syntax, let me know because it could just be a
> bad
> set of struts jars (which I can replace).
>
> -Wes
>
> > -----Original Message-----
> > From: Tom Schneider [mailto:schneidh@gmail.com]
> > Sent: Tuesday, January 23, 2007 1:50 PM
> > To: Struts Users Mailing List
> > Subject: Re: [s2] String comparison with OGNL
> >
> > #parameters.addrType is of type String correct?  If not, e.g.
> > if it were an
> > enum, then I would expect all the comparisons to fail.  You might try
> > #parameters.addrType.toString().equals('billing') and see if
> > that gets it to
> > work.
> > Tom
> >
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message