On 8/9/05, C.F. Scheidecker Antunes <[EMAIL PROTECTED]> wrote:
> How do you save something to the Session scope and then access it within
> Struts?
> I pretty much understand how to do it within a Servlet.

You can do this directly, or you can setup your ActionForm class to
have session scope. ActionForm is simply a bean which lifecycle is
controlled by Struts using scope setting that you set in <action>
element of config file. If you select "request" scope, Struts will
stick ActionForm in request object. If you select "session" scope,
Struts will stick ActionForm into the session.

The <form-beans> section of config file defines keys, under which
Struts stores ActionForm objects in implicit scope objects. In a
sense, ActionForm is just a [convenient?] container for the stuff
related to an action.

I personally find it easier to have everything related to an action in
a corresponding ActionForm. If I need to store data during several
requests, I use session scope for an ActionForm. Another approach is
to use request scope for ActionForms, and to save session-scoped stuff
directly into session object.

Michael.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to