This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Extendings Struts Action (creating a custom Action class) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Extendings Struts Action (creating a custom Action class)" Watch "Extendings Struts Action (creating a custom Action class)" New topic
Author

Extendings Struts Action (creating a custom Action class)

DN Debed
Greenhorn

Joined: Nov 03, 2008
Posts: 10
I'm thinking of extending the struts Action class to create a custom Action class that my application will use to extend. This is because my application contains attributes (objects) that are stored in the servlet and would be used by most action classes.

Below would be a draft of my custom Action class



Then, all my action classes would extend CustomAction. Such as my example below.



The advantage that I see is that:
1. Other actions does not need to always write to get a servlet attribute. They can just call .
2. I can easily change the name of the servlet attribute in my custom action class and not worry about changing my other action classes that is using this attribute.

So far this is what I have in mind. I would like to know if my idea is okay (what problems/limitations might arise if I use this approach).

Thank you
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Sure, that will work fine--it's a very common technique.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Extendings Struts Action (creating a custom Action class)
 
Similar Threads
Spring : how to redirect to login page on session timeout
Problem in accessing c:set tag.
bean not populated
logic:iterate pls any body help me
Get rid of line numbers