Java Reference
In-Depth Information
Use an application controller to decouple action and view handling from the front
Strategies with the Spring Framework
The application controller is an important internal component of any Java EE web frame-
work. Since it sits silently behind the gateway servlet and generally suffices to all the
requirements of an application, developers are seldom bothered about this component.
In the Struts framework, for instance, the RequestProcessor class does the job of an
application controller. Internally, the Struts front controller ActionServlet delegates the
view and action management to this class. It is possible to extend this class to override
the default behavior. But Struts developers hardly ever do that.
Spring MVC provides similar support for action-view management orchestrated by
the DispatcherServlet . As with Struts, no effort is generally required from the developers
except, perhaps, some optional configuration. You have already seen this in earlier exam-
ples. You have neither written any code nor done any configuration for view or action
handling. Yet the request for the resource was handled by the appropri-
ate page controller. This is possible because Spring has sensible defaults for command
and view handling. In the next few sections, I will go through the various application
controller configuration options available with the Spring Framework. The Spring Frame-
work is highly flexible in that it separates the application controller into two distinct parts
to be discussed in the next few sections.
Action Handling
Spring action/command handling can be slightly overwhelming at first because lots of
classes are involved. So, we will take it in simple steps. Figure 3-2 shows a simplified view
of the action management workflow. I have deliberately left out the view management
part for now.
Search WWH ::

Custom Search