I'll send it to you directly.


--
James Mitchell



----- Original Message ----- 
From: "Erez Efrati" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Sunday, May 09, 2004 8:00 AM
Subject: RE: BaseDispacthAction?


> Hi James, could you please be more specific about this recursion bug? I
> am using the 1.1 version so it would help..
> 
> Erez
> 
> -----Original Message-----
> From: James Mitchell [mailto:[EMAIL PROTECTED] 
> Sent: Friday, May 07, 2004 7:50 PM
> To: 'Struts Users Mailing List'
> Subject: RE: BaseDispacthAction?
> 
> It should work just fine.
> 
> - change your base action to extend DispatchAction
> - in execute(), call preProcess(), super.execute(), then postProcess()
> 
> ...assuming you've implemented your custom methods (e.g. search(),
> save(),
> whatever() ) and you understand how DispatchAction works, it should all
> fall
> into place and work fine.
> 
> NOTE - DispatchAction has a pretty serious bug in the Struts 1.1 version
> (potential recursive loop until the server spits out of memory
> exceptions),
> so you will want to use a later version or add a fix in your BaseAction.
> Let me know if you need help with it.
> 
> 
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> EdgeTech, Inc.
> 678.910.8017
> AIM: jmitchtx
>  
> 
> > -----Original Message-----
> > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Gianluca
> > Sent: Friday, May 07, 2004 8:55 AM
> > To: [EMAIL PROTECTED]
> > Subject: BaseDispacthAction?
> > 
> > I've defined and I'm using a subclass of Action 
> > (my.package.BaseAction), in order to implement the Template 
> > design pattern, so I use this class instead of the Action 
> > class provided by STRUTS. The intended goal is that things 
> > that are common to all actions are performed here, such as 
> > logging and validation of the user's session, some 
> > postprocessing, etc. 
> > In that class I've declared the execute(..) method as final, 
> > so that no subclass can override it:
> > 
> > public final ActionForward execute(
> > ActionMapping mapping,
> > ActionForm form,
> > HttpServletRequest request,
> > HttpServletResponse response)
> > throws Exception {
> > 
> > _log = Logger.getLogger(this.getClass());
> > if (_log.isDebugEnabled()) {
> > _log.debug(someString);
> > }
> > 
> > try {
> > // Check for precondition errors; fail if found
> > if (preProcess(mapping,form,request,response)) {
> > // Execute actual logic
> > ActionForward forward = 
> > executeLogic(mapping,form,request,response);
> > }
> > // Some postprocessing...
> > postProcess(mapping,form,request,response);
> > 
> > return forward;
> > 
> > } catch (SessionNotValidActionException se) {
> > if (_log.isDebugEnabled()) {
> > _log.debug("Session is not valid, 
> > redirecting to login.");
> > }
> > return mapping.findForward("login");
> > } catch (...) {
> > ...
> > } finally {
> > ...
> > }
> > 
> > if (_log.isDebugEnabled()) {
> > _log.debug("Leaving execute method.");
> > }
> > }
> > 
> > and I provide the two methods - preProcess and postProcess - 
> > together with an abstract executeLogic method, and some other 
> > common helper needs into utility methods.
> > 
> > But Actions classes are often too small, and this ruins the 
> > cohesiveness of the application. So I would like to start 
> > employing DispactchAction classes to group related actions. 
> > Do you have any suggestion on how to implement the above 
> > approach (template pattern) to extend DispatchAction, in 
> > order to define a BaseDispatchAction?
> > 
> > Thanks,
> > Gianluca
> > 
> > 
> > ---------------------------------------------------------------------
> > 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]
> 
> 
> 
> ---------------------------------------------------------------------
> 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