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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic