I am a beginner to Struts2. Please tell me why to extend ActionSupport
class? (When one doesn't have the requirement of validation or internationalization)
Are there any other benefits provided by extending ActionSupport
class?
Convenience and access to basic, common functionality.
It has default implementations of common methods (e.g., execute()
, input()
), gives access to Action.SUCCESS
and other result names, etc.
Note that the I18N functionality goes a bit beyond simple translation, but includes some formatting, allows non-programmers to provide labels/texts, and so on.
There's rarely (ever?) a good reason not to extend it. Even REST plugin actions, e.g., those that handle JSON endpoints, often use validation and I18N support.