- The Action is part of the controller. The purpose of Action Class is to translate the HttpServletRequest to the business logic.
- To use the Action, we need to Subclass and overwrite the execute() method.
- The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method.
- There should be no database interactions in the action.
- The action should receive the request, call business objects (which then handle database, or interface with J2EE, etc) and then determine where to go next.
- Even better, the business objects could be handed to the action at runtime (IoC style) thus removing any dependencies on the model.
- The return type of the execute method is ActionForward which is used by the Struts
- Framework to forward the request to the file as per the value of the returned ActionForward object.
Advertisement
Filed under: Struts