I have common code, which will be used by all the classes extending Action and DispatchAction Classes in the application. If there is only one base class extending DispatchAction class, then all the classes which wants to use only Action class features will be forced to configure 1)'parameter' attribute in the action element in the struts-config.xml and 2) supply 'parameter' information through the HTTP request.
To Avoid this i will have to use two base classes with same code. one extending Action class and the other extending <br>ActionDispatch.
What are you trying to accomplish by doing this? What scenario is causing you to have to split the logic in this way?
Joined: Dec 15, 2003
Originally posted by David Yutzy: What are you trying to accomplish by doing this? What scenario is causing you to have to split the logic in this way?
Thanks for the reply: There are two kinds of action handler in the application: 1) Extending Action class 2) Extending ActionDispatch class I have identified some common code used by all the action handler classes. Which will be put in base class. If i have common base class 'BaseActionDispatch' extending ActionDispatch, for above two classes. Then classes which were earlier extending Action class, now needs to provide following information, 1) 'parameter' attribute in the action element of the struts-config.xml file 2) the value of the 'parameter' and the method name needs to be appended to the url in every request send to the action handler classes. Eg: struts-config.xml <action path="/test" type="MyDispatchAction" parameter="method" > url: <a href="testLog.do?method=test"> call DispatchAction</a> This is required because the Base class is extending ActionDispatch, which makes it Mandatory to provide above 2 information. But above 2 information is redundant for those classes which were earlier extending Action class, but they need to provide as they are now extending BaseActionDispatch class. If i don't provide the first information. i get the following error "DispatchAction - -DispatchMapping[/test] does not define a handler property" (i am using in jdeveloper9.0.3)
subject: How to have Common base class for classes extending Action and DispatchAction Classe