91-9990449935 0120-4256464 |
Struts 2 ActionIn struts 2, action class is POJO (Plain Old Java Object). POJO means you are not forced to implement any interface or extend any class. Generally, execute method should be specified that represents the business logic. The simple action class may look like: Welcome.javaAction InterfaceA convenient approach is to implement the com.opensymphony.xwork2.Action interface that defines 5 constants and one execute method. 5 Constants of Action InterfaceAction interface provides 5 constants that can be returned form the action class. They are:
Let's see what values are assigned to these constants: Method of Action InterfaceAction interface contains only one method execute that should be implemented overridden by the action class even if you are not forced. Example of Struts Action that implements Action interfaceIf we implement the Action interface, we can directly use the constants instead of values. Welcome.javaActionSupport classIt is a convenient class that implements many interfaces such as Action, Validateable, ValidationAware, TextProvider, LocaleProvider and Serializable . So it is mostly used instead of Action. Example of Struts Action that extends ActionSupport classLet's see the example of Action class that extends the ActionSupport class. Welcome.java
Next TopicStruts2 Configuration File
|