You could, but I would recommend using the *Aware interfaces in your
actions. It makes them easier to test.

Nils-H

On 9/11/07, j alex <[EMAIL PROTECTED]> wrote:
> I can do Map attibutes = ActionContext.getContext().getSession(); from an
> Action - right?
>
> On 9/11/07, Chris Pratt <[EMAIL PROTECTED]> wrote:
> >
> > Basically, for Actions you should use SessionAware (since you don't
> > have access to the ActionContext from within a standard Action).  But
> > if you are writing an Interceptor, you would use ActionContext to get
> > access to the Session data.
> >   (*Chris*)
> >
> > On 9/11/07, j alex <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > In the Struts 2 docs, it's recommended to implement SessionAware for
> > > accessing session within Action, but looking at some Webwork
> > documentation,
> > > http://wiki.opensymphony.com/display/WW1/SessionAware+Actions  - it
> > seems to
> > > convey the opposite message .
> > >
> > > Please clarify :
> > >
> > > 1. Why accessing via ActionContext is not advisable ?
> > > 2. In SessionAware API doc it's said  " Note that using this interface
> > makes
> > > the Action tied to a servlet environment, so it should be avoided if
> > > possible since things like unit testing will become more difficult." --
> > how
> > > is it tied to servlet env, since we are not having any HTTP-specific
> > code in
> > > the Action but just a plain setSession(Map map) method?
> > >
> > > Thanks,
> > > Joseph
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

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

Reply via email to