I've done the same sort of thing in the past, but over time I grew to
dislike the fact that all my actions needed to extend the one that
implemented this special logic. It made it so that I couldn't freely use
standard actions, like those defined in org.apache.struts.actions.
However, by putting this logic in the front controller
(RequestProcessor/ActionServlet) component you break the dependency on
the base action and life is good again...

Troy

On Mon, 2002-07-29 at 17:10, Struts Newsgroup (@Basebeans.com) wrote:
> Subject: Re: validating existence of session attributes in all Actions
> From: "David Chu" <[EMAIL PROTECTED]>
>  ===
> Ah, thanks, I ended up creating a subclass of Action,
> VerifySessionVarsAction, whos perform() verifies certain session variables
> then calls performWithVerifiedUser().  This new method
> performWithVerifiedUser() does nothing in this class but subclasses of
> VerifySessionVarsAction, such as GetUserShoppingCart() override
> performWithVerifiedUser rather than perform().  This seems to work pretty
> well.  (Is this a good design?) Thanks!
> 
> --
> -david
> 
> ------------------------------
> David C. Chu
> America Online
> Network Tools Intern
> ------------------------------
> "Troy Hart" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > You could extend the request processor if you are using 1.1 or the
> > ActionServlet otherwise. Every request is handled by these front
> > controllers and therefore they provide a good place to put logic that
> > pertains to all your actions. To answer your last question, look at the
> > process() method of the ActionServlet or RequestProcessor (which ever is
> > appropriate for your app).
> >
> > Hope this helps,
> >
> > Troy
> >
> >
> >
> > On Sat, 2002-07-27 at 12:55, Struts Newsgroup (@Basebeans.com) wrote:
> > > Subject: validating existence of session attributes in all Actions
> > > From: "David Chu" <[EMAIL PROTECTED]>
> > >  ===
> > > What is the best way to check across all (or most) Actions that certain
> > > session attributes are set?  I could do an if test inside each Action's
> > > perform() but I was wondering if there is a standard extension to handle
> > > this?  So does the ability to define a universal pre_perform() exist?
> > >
> > > --
> > > -david
> > >
> > > ------------------------------
> > > David C. Chu
> > > America Online
> > > Network Tools Intern
> > > ------------------------------
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 



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

Reply via email to