You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Affan Qureshi <qu...@etilize.com> on 2002/11/01 05:33:53 UTC

Re: Actions and Sessions

Why dont you do:
request.getSession(true).setAttribute(PROFILE_KEY,profile) in the Action
object itself.

----- Original Message -----
From: "Bruce Van Horn" <bv...@swbell.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, November 01, 2002 3:38 AM
Subject: Actions and Sessions


> What is the most efficient way to place information coming to a JSP from
an
> Action into a session object?
>
> I have an action that reads a database for user profile information.  It
> needs to be flexible enough such that changes to the data model don't
> require code changes in the Action.  This has been achieved -- the Action
> dynamically writes whatever comes back from the query.
>
> I can put these dynamic properties into the JSP with setAttributes() and
get
> them out on the other side, but I'd like to immediately store them in a
> session so the user's profile will be available for the entire session.
>
> The obvious approach is to create code in the JSP to create the session
and
> store the info.  However I want to utilize a frame for sidebar navigation,
> and since I include access permissions in the profile, I need all pages in
> the frames to have access to the profile info on page load.  This means I
> would have to code an intermediate page that loads the session data then
> forwards to the frames, which seems kludgy to me.
>
> Any ideas are greatly appreciated!  Thanks!
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>