File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
generic code in action
mark smith
Ranch Hand
Joined: Apr 05, 2005
Posts: 240
posted
Jul 19, 2010 08:28:08
0
hi
i have two class who extends DispatchAction
theses two class use the same form class
theses two class have the same action, majority of the code of this theses actions are similar
example
public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { //different code ... ... //same code .... return mapping.findForward("success"); }
is there a way to use these similar code for my two class who extends DispatchAction?
thanks
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Jul 19, 2010 10:17:40
0
This seems pretty non-Struts specific.
There are at least a couple of options:
- Create a base class with a call-out to the class-specific part
- Create a sub class that calls a non-class-specific method
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: generic code in action
Similar Threads
How to have Common base class for classes extending Action and DispatchAction Classe
Difference Between DispatchAction and Action (Not the usual question)
Common base class for classes extending Action and DispatchAction Classes
Dyna Action Vs Dispatch Action
Override DispatchAction but keep the existing funcationallity
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter