Core classes of the Struts Framework

Explain the core classes of the Struts Framework.

- The core classes of struts framework are:

1. ActionServlet
2. ActionForm
3. Action
4. Action Mapping
5. ActionForward

ActionServlet:

ActionServlet is the back bone of the whole web application.

ActionForm:

ActionForm is a java bean that associates one or more ActionMappings.The bean is initialized from the corresponding parameters of the requests before the Action.execute method is invoked. The bean’s validate() method will be called, before the execution of execute() method. This process is done before the bean properties have been populated. The verification of properties submitted by the user input form is validated by the validate() method. If the method finds problems, an error messages object those are encapsulated the problems will be returned and the controller servlet will return the control back to the input form. If not, the validate() method returns null, which is the indication of accepting everything, and the Action.execute method should be invoked.

Action:

This class is extended by the org.apache.struts.action.Action class. The business logic is wrapped by the Action class and this class provides an interface to the Model of the application. Action class can be viewed as a glue between the View and the Model layer of MVC architecture. The data transfer from the view layers to the specific business process layer(View to Model) is done by this class. The processed data from the business layer to view layer is returned ultimately. The struts controller i.e., ActionServlet , chooses an appropriate Action and the instance is created if necessary and invokes execute() method.

ActionMapping:

The ActionMapping is used to provide mappings for Objects to Actions. An action map is used in association with InputMap to locate an action at time of pressing a key. An action mapping can contain a reference to a form bean that the action can use. A reference to a form bean is contained by an action mapping. The reference to a form is used by an action.

ActionForward:

It is represented as a destination for the controller, RequestProcessor, that might be directed a RequestDispatcher.forward or HttpServletResponse.sendRedirect to. This is the result of processing activities of an Action class. The instances of this classes is created dynamically as the need arises.
What are the drawbacks of Struts?
What are the drawbacks of Struts? - Single controller servlet – Only one ActionServlet is available which may be an issue of scalability....
Explain Struts navigation flow
Struts navigation flow - After deploying the application in the server, the container reads the information from web.xml....
Explain the design patterns used in Struts
Design patterns used in Struts - The Struts design pattern has N-tier architecture. This includes MVC architecture, Web applications characters, struts framework which includes – architecture, design patterns and coding idioms.....
Post your comment