Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extendings Struts Action (creating a custom Action class)

 
DN Debed
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, that will work fine--it's a very common technique.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic