aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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

Extendings Struts Action (creating a custom Action class)

DN Debed

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

Joined: Sep 29, 2008
Posts: 12617

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