OMG!

that was it!!!

I would never have figured out by myself,

THANKS BILL!!!

2010/6/26 Bill Bohnenberger <bill98...@gmail.com>

> Since 'activated' is a String, try swapping your single & double quotes,
> e.g.
> <s:if test='%{warning.activated=="Y"}'>
>
> -Bill
>
> On Sat, Jun 26, 2010 at 11:28 AM, lucas owen <sr.ilus...@gmail.com> wrote:
>
> > Hi Struts 2 users:
> >
> > I was wondering if you can use a s:if test based on a pojo's
> > attribute value:
> >
> > POJO:
> >
> > public class Warning{
> >
> > String text;
> > String activated; // Y or N
> >
> > }
> >
> > JSP:
> >
> > <s:if test=*"%{warning==null}"*>
> >
> > --> *Warning* null!
> >
> > </s:if>
> >
> > <s:else>
> >
> > --> *Warning* not null!
> >
> > --> Activated: <s:property value=*"warning.activated"*/>
> >
> > <s:if test=*"warning.activated == 'Y' "*>
> >
> > --> *Warning* *activated*.
> >
> > </s:if>
> >
> > <s:else>
> >
> > --> *Warning* *deactivated*.
> >
> > </s:else>
> >
> > </s:else>
> >
> > The first test (check null value) works OK, but the second always goes
> > through the else part.
> >
> > I have tried test=*"%{warning.activated == 'Y' }" and
> > *test=*"%{#warning.activated
> > == 'Y' }" *too but it doesnt work either.
> >
> > I dont know what is wrong, <s:property value=*"warning.activated"*/>
> shows
> > the value correctly...
> >
> >
> >
> > I know I can use an auxiliar boolean variable depending on the value Y/N
> > but
> > I would like to know why it doesnt work this way.
> >
> > THANKS IN ADVANCE
> >
>

Reply via email to