You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Darren Salomons <na...@digid.mailcan.com> on 2007/03/27 08:41:04 UTC

if tag doesn't seem to work(Struts 2)

I don't know if this is a bug or if I'm doing something wrong but the if tag
in Struts 2 always returns false for the first run and then if I hit refresh
it gets the correct value.


In my action class I have a method like this:

getStatement() {
    return true;
}


And then in my jsp I do something like:

<s:if test=${statement}>Hello World</s:if>

Hello World is only printed after I hit reload.  I cleared my cache, opened
my browser and tried again and the same thing happens.

Any ideas?  Darren
-- 
View this message in context: http://www.nabble.com/if-tag-doesn%27t-seem-to-work%28Struts-2%29-tf3471295.html#a9687189
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: if tag doesn't seem to work(Struts 2)

Posted by Darren Salomons <na...@digid.mailcan.com>.
Yes thank you... I had confused it with the JSTL.

Thanks


joey-30 wrote:
> 
>   I thought it may be like this:
> <s:if test="statement"}>Hello World</s:if> or
> <s:if test="%{statement}"}>Hello World</s:if>
> 
> On 3/27/07, Darren Salomons <na...@digid.mailcan.com> wrote:
>>
>>
>> I don't know if this is a bug or if I'm doing something wrong but the if
>> tag
>> in Struts 2 always returns false for the first run and then if I hit
>> refresh
>> it gets the correct value.
>>
>>
>> In my action class I have a method like this:
>>
>> getStatement() {
>>     return true;
>> }
>>
>>
>> And then in my jsp I do something like:
>>
>> <s:if test=${statement}>Hello World</s:if>
>>
>> Hello World is only printed after I hit reload.  I cleared my cache,
>> opened
>> my browser and tried again and the same thing happens.
>>
>> Any ideas?  Darren
>> --
>> View this message in context:
>> http://www.nabble.com/if-tag-doesn%27t-seem-to-work%28Struts-2%29-tf3471295.html#a9687189
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/if-tag-doesn%27t-seem-to-work%28Struts-2%29-tf3471295.html#a9706354
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: if tag doesn't seem to work(Struts 2)

Posted by tom tom <j_...@yahoo.com>.
try any of these, dont get confused with jstl, also be
careful using % vs #

<s:if test="%{statement}">Hello World</s:if>

<s:if test="statement">Hello World</s:if>

let us know if further problem exists

Thanks

--- joey <re...@gmail.com> wrote:

>   I thought it may be like this:
> <s:if test="statement"}>Hello World</s:if> or
> <s:if test="%{statement}"}>Hello World</s:if>
> 
> On 3/27/07, Darren Salomons
> <na...@digid.mailcan.com> wrote:
> >
> >
> > I don't know if this is a bug or if I'm doing
> something wrong but the if
> > tag
> > in Struts 2 always returns false for the first run
> and then if I hit
> > refresh
> > it gets the correct value.
> >
> >
> > In my action class I have a method like this:
> >
> > getStatement() {
> >     return true;
> > }
> >
> >
> > And then in my jsp I do something like:
> >
> > <s:if test=${statement}>Hello World</s:if>
> >
> > Hello World is only printed after I hit reload.  I
> cleared my cache,
> > opened
> > my browser and tried again and the same thing
> happens.
> >
> > Any ideas?  Darren
> > --
> > View this message in context:
> >
>
http://www.nabble.com/if-tag-doesn%27t-seem-to-work%28Struts-2%29-tf3471295.html#a9687189
> > Sent from the Struts - User mailing list archive
> at Nabble.com.
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> 



 
____________________________________________________________________________________
Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: if tag doesn't seem to work(Struts 2)

Posted by joey <re...@gmail.com>.
  I thought it may be like this:
<s:if test="statement"}>Hello World</s:if> or
<s:if test="%{statement}"}>Hello World</s:if>

On 3/27/07, Darren Salomons <na...@digid.mailcan.com> wrote:
>
>
> I don't know if this is a bug or if I'm doing something wrong but the if
> tag
> in Struts 2 always returns false for the first run and then if I hit
> refresh
> it gets the correct value.
>
>
> In my action class I have a method like this:
>
> getStatement() {
>     return true;
> }
>
>
> And then in my jsp I do something like:
>
> <s:if test=${statement}>Hello World</s:if>
>
> Hello World is only printed after I hit reload.  I cleared my cache,
> opened
> my browser and tried again and the same thing happens.
>
> Any ideas?  Darren
> --
> View this message in context:
> http://www.nabble.com/if-tag-doesn%27t-seem-to-work%28Struts-2%29-tf3471295.html#a9687189
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>