You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Richard Reyes <ri...@gmail.com> on 2005/02/22 12:40:36 UTC

Help with Struts-Logic Tag

Hello Guys,

I have this tag ...

<logic:notPresent name="hello.world" ><logic:redirect
href="routes-login.rr" /></logic:notPresent>

And I need to change hello.world to Konstants.HELLO_WORLD. Now this...

<logic:notPresent name="Konstants.SESSION_USER_KEY" ><logic:redirect
href="routes-login.rr" /></logic:notPresent>

does not seem to work( of course ). 

Please help. Thanks

Richard

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


Re: Help with Struts-Logic Tag

Posted by Tim Christopher <ti...@gmail.com>.
Sorry slight typo - try something of the form:

<logic:present name="<%=Konstants.SESSION_USER_KEY%>">
    <logic:redirect href="routes-login.rr" />
</logic:present>

Note the <%= at the start of the name value.

If you look using Google you can problem find a simple tutorial to
explain all about the logic tags but put simply the above statement
checks for the presence of a bean named the value of
Konstants.SESSION_USER_KEY.  If this bean is present then it will
evaluate the nested content of the tag.

In most tutorials (I'd imagine) you'll see the value of the name
attribute will be something like "user".  By using
<%=Konstants.SESSION_USER_KEY%> instead you're telling it to look up
this value.

Hope that helps you a bit.

Tim Christopher

On Thu, 24 Feb 2005 17:51:35 +0800, Richard Reyes
<ri...@gmail.com> wrote:
> Hi Tim/Guys,
> 
> the 2nd option is not working.
> 
> can you elaborate on the first one?
> 
> how do i declare the user? usebean?
> 
> thanks
> 
> Richard
> 
> 
> On Tue, 22 Feb 2005 12:53:55 +0000, Tim Christopher
> <ti...@gmail.com> wrote:
> > Try using:
> >
> > <logic:notPresent name="user" >
> >    <logic:redirect href="routes-login.rr" />
> > </logic:notPresent>
> >
> > Where user = Konstants.SESSION_USER_KEY, or maybe even:
> >
> > <logic:notPresent name="<% Konstants.SESSION_USER_KEY %>" >
> >     <logic:redirect href="routes-login.rr" />
> > </logic:notPresent>
> >
> > Tim Christopher
> >
> > On Tue, 22 Feb 2005 19:40:36 +0800, Richard Reyes
> > <ri...@gmail.com> wrote:
> > > Hello Guys,
> > >
> > > I have this tag ...
> > >
> > > <logic:notPresent name="hello.world" ><logic:redirect
> > > href="routes-login.rr" /></logic:notPresent>
> > >
> > > And I need to change hello.world to Konstants.HELLO_WORLD. Now this...
> > >
> > > <logic:notPresent name="Konstants.SESSION_USER_KEY" ><logic:redirect
> > > href="routes-login.rr" /></logic:notPresent>
> > >
> > > does not seem to work( of course ).
> > >
> > > Please help. Thanks
> > >
> > > Richard
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
>

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


Re: Help with Struts-Logic Tag

Posted by Richard Reyes <ri...@gmail.com>.
Hi Tim/Guys,

the 2nd option is not working.

can you elaborate on the first one?

how do i declare the user? usebean?

thanks

Richard


On Tue, 22 Feb 2005 12:53:55 +0000, Tim Christopher
<ti...@gmail.com> wrote:
> Try using:
> 
> <logic:notPresent name="user" >
>    <logic:redirect href="routes-login.rr" />
> </logic:notPresent>
> 
> Where user = Konstants.SESSION_USER_KEY, or maybe even:
> 
> <logic:notPresent name="<% Konstants.SESSION_USER_KEY %>" >
>     <logic:redirect href="routes-login.rr" />
> </logic:notPresent>
> 
> Tim Christopher
> 
> On Tue, 22 Feb 2005 19:40:36 +0800, Richard Reyes
> <ri...@gmail.com> wrote:
> > Hello Guys,
> >
> > I have this tag ...
> >
> > <logic:notPresent name="hello.world" ><logic:redirect
> > href="routes-login.rr" /></logic:notPresent>
> >
> > And I need to change hello.world to Konstants.HELLO_WORLD. Now this...
> >
> > <logic:notPresent name="Konstants.SESSION_USER_KEY" ><logic:redirect
> > href="routes-login.rr" /></logic:notPresent>
> >
> > does not seem to work( of course ).
> >
> > Please help. Thanks
> >
> > Richard
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

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


Re: Help with Struts-Logic Tag

Posted by Tim Christopher <ti...@gmail.com>.
Try using:

<logic:notPresent name="user" >
   <logic:redirect href="routes-login.rr" />
</logic:notPresent>

Where user = Konstants.SESSION_USER_KEY, or maybe even:

<logic:notPresent name="<% Konstants.SESSION_USER_KEY %>" >
    <logic:redirect href="routes-login.rr" />
</logic:notPresent>

Tim Christopher

On Tue, 22 Feb 2005 19:40:36 +0800, Richard Reyes
<ri...@gmail.com> wrote:
> Hello Guys,
> 
> I have this tag ...
> 
> <logic:notPresent name="hello.world" ><logic:redirect
> href="routes-login.rr" /></logic:notPresent>
> 
> And I need to change hello.world to Konstants.HELLO_WORLD. Now this...
> 
> <logic:notPresent name="Konstants.SESSION_USER_KEY" ><logic:redirect
> href="routes-login.rr" /></logic:notPresent>
> 
> does not seem to work( of course ).
> 
> Please help. Thanks
> 
> Richard
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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