struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wes Wannemacher" <w...@wantii.com>
Subject Re: Global Values and the Value Stack
Date Sat, 29 Dec 2007 04:52:58 GMT
Is there a reason why you couldn't use the session? If you put the
objects in the session, they would be available pretty much like you
have -

<s:property value="%{#session.user.name}" />

-Wes

On 12/28/07, Chris Pratt <thechrispratt@gmail.com> wrote:
> Well, looks like I might have found it myself.  If my Interceptor adds
> a variable to the Context in the Value Stack, then I can access the
> variable using the # delimiter.  So if my UserInterceptor calls:
>
> stack.getContext().put("user",user);
>
> Then in the page I can use:
>
> <s:property value="%{#user.name}"/>
>
> to display the User's Name on any page that is using my application
> interceptor stack.
>
> Hope that helps anyone else that runs into the same question.
>   (*Chris*)
>
> On Dec 28, 2007 1:28 PM, Chris Pratt <thechrispratt@gmail.com> wrote:
> > I have some values that are required on, pretty much, every page of
> > the site.  Thinks that belong in the headers and navigation section
> > for example.  I'd rather not have to add them to every Action, or
> > force every Action to extend a base action, so is there a way to add
> > values to the value stack (say from an interceptor), that doesn't take
> > over the "pole position" and interfere with things accessing the
> > Action using the stack?
> >   (*Chris*)
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

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


Mime
View raw message