Your CommonCode solution is the way I went (I called mine BaseActionHelper).
Your subclass of DispatchAction would look something like this below. public abstract class MyDispatchAction extends DispatchAction { public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Exception { //common code for all action classes CommonClass cc = new CommonClass(); // just sample method cc.doValid(); return super.execute(mapping, form, request, response); } } > -----Original Message----- > From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 03, 2003 11:17 AM > To: [EMAIL PROTECTED] > Subject: Override DispatchAction but keep the existing funcationallity > > > Hi, > I want to extend functions of dispatchAction class, > like i want a class which extends DispatchAction and > overrides the execute method, But keep all the > existing functions, > But if i override the execute method, then i will have > to code the same function available in origianl > DispatchAction, and add my extra functions, ( like cut > and paste the code) but then if in future > DispatchAction is modified i will need to modify my > class. > > or have one class which will have all the functions of > DispatchAction , but also want to add more functions. > > What i have done in MyActionClass is > public abstract class MyAction extends Action > { > public ActionForward execute(ActionMapping mapping, > ActionForm form,HttpServletRequest request, > HttpServletResponse response) > throws Exception > { > > //common code for all action classes > CommonClass cc = new CommonClass(); > // just sample method > cc.doValid(); > return performTask(mapping, form, request, > response); > } > // this is the method which will be implemented by > each overriding class and add the necessary logic > protected abstract ActionForward > performTask(ActionMapping mapping, > ActionForm form, HttpServletRequest > request, > HttpServletResponse response) > throws Exception; > > } > I have a CommonClass for doing all the common > function, > How can i do it DispatchAction > Ashish > > ===== > A$HI$H > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > --------------------------------------------------------------------- > 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]