• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to have Common base class for classes extending Action and DispatchAction Classe

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
tumbleweed and gunslinger
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are you trying to accomplish by doing this? What scenario is causing you to have to split the logic in this way?
 
ajit alwe
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic