Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes Important classes in Struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Important classes in Struts?" Watch "Important classes in Struts?" New topic
Author

Important classes in Struts?

Mathew Chen
Greenhorn

Joined: Aug 01, 2005
Posts: 18
Hi,
About from the Action and the DispatchAction classes is there any other class which one can extend?

Thanks in advance.

Mathew
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It is also common to extend ActionForm.

Technically, though, you can extend any class in Struts that isn't declared as final. Struts is open-source, so you can look at the source and extend classes as needed. ActionServlet, RequestProcessor, ActionMapping, etc. can all be extended. I wouldn't recommend doing so, however, unless you're doing something that just doesn't fit into the way Struts works by default.


Merrill
Consultant, Sima Solutions
Mathew Chen
Greenhorn

Joined: Aug 01, 2005
Posts: 18
Thanks Merril for your reply.I think I missed out the LookUpDispatch class too.

Thanks again
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
DispatchAction and LookupDispatchAction both extend Action. you can extend pretty much everything like what merrill said, but consider first the reason(s) for extension.

i generally stay way from the core classes. consider using servlet filters to do generic pre-processing (e.g authentication) and post-processings (e.g applying xslt). there are properties of the struts controller that are configurable, but unknown and lead to unecessary extension (e.g setting nocache).

it is a good idea though to extend the Action classes since you can move common action codes such as the forwarding and error processings into 1 place. action form is another, but declarative form bean definitions cannot be extended (unless you customize the ActionServlet


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
 
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: Important classes in Struts?
 
Similar Threads
Topic for JavaRanch Journal Article / SCJP Tipline
What is a class file with $ symbol in the name
Codebase
WA #1.....word association
Problem finding property file with Resource Bundle