Java Reference
In-Depth Information
The sequence of events in Struts is as follows:
The ActionServlet delegates request processing to a RequestProcessor .
1.
The RequestProcessor processes the request and stores the form values in
the ActionForm .
2.
The RequestProcessor then invokes the Action class.
3.
The Action class accesses the ActionForm to retrieve the form values.
4.
The Action class invokes the call to the service layer.
5.
The Action class returns the ActionForward , which is used to encapsulate
the response view.
6.
Struts 2, however, is different from Struts. Unlike Struts, which follows a push-MVC architecture
where data is expected to be present in the page or scope, Struts 2is a pull-MVC architecture; that
is, the data can be pulled from the Action . Table 4-2 shows a one-to-one mapping of the Struts and
Struts 2 framework elements.
Table 4-2. One-to-One Mapping of Struts and Struts 2Framework Elements
Struts Framework Elements
Struts 2 Framework Elements
ActionServlet
Servlet filter
RequestProcessor
Interceptor
Action
Action
ActionForm
Action or POJOs
ActionForward
Result
Note You can find a comprehensive list of similarities and differences between Struts and Struts 2 at
http://struts.apache.org/release/2.3.x/docs/comparing-struts-1-and-2.html .
Figure 4-2 illustrates the key elements of Struts 2 that provide a cleaner implementation of MVC.
 
 
Search WWH ::




Custom Search