Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Override DispatchAction but keep the existing funcationallity

Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
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
Message for you sir! I think it is a tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic