Wednesday, October 14, 2009

Struts and the Controller Layer













Struts and the Controller Layer


Struts provides a robust Controller layer implementation that has been designed from the ground up to be extensible. At its core is the Controller servlet, ActionServlet, which is responsible for initializing a Struts application's configuration from the Struts configuration file and for receiving all incoming requests to the application. Upon receiving a request, ActionServlet delegates its processing to the Struts request processing engine. The request processing engine processes all aspects of the request, including selecting the Form Bean associated with the request, populating the Form Bean with data, validating the Form Bean, and then selecting the correct Action class to execute for the request. The Action class is where the Struts framework ends and your application code begins. Action classes provide the glue between the View and Model layers and return instances of the ActionForward class to direct the Controller which View to display. Figure 5-1 illustrates the Controller layer lifecycle.






Figure 5-1: The Controller layer lifecycle

The following sections explain each of the major Controller layer components in detail.














No comments:

Post a Comment