Java Reference
In-Depth Information
Apart from the controllers discussed so far, Spring MVC provides few other con-
trollers (abstract as well as concrete implementations) for specific requirements. Some of
these controllers are listed in Table 3-1.They are required occasionally only for a handful
of use cases.
Table 3-1. Occasionally Useful Page Controllers
File Name
Description
MultiActionController
Some developers think it is useful to group a logical set of
actions into a single controller implementation class. All
the actions related to a policy creation page—Save, Edit,
and so on—can be placed in a single class that extends the
MultiActionController . This is useful in reducing
concrete implementations of page controllers for a large
application. Spring MVC can determine which method to
invoke using a class called MethodNameResolver . This class
can determine the method name from a parameter set in
the HttpServletRequest .
AbstractWizardFormController
Some use cases in an application are best handled by
presenting multiple pages, before final action is taken.
Such multistep use cases are commonly seen in web
applications for the registration or sign-up process.
eInsure also deployed a multistep workflow for collecting
policy and claim details. Spring MVC provides out-of-the-
box support to model use cases of this kind through the
AbstractWizardFormController class.
Consequences
Benefits
Increased reusability : The consolidation of use case processing in page controllers
enables reuse.
Increased extensibility : With Spring support, it is possible not only to implement
custom page controllers but also to integrate with page controllers of other frame-
works such as Struts, WebWork, and so on.
Life-cycle support : Without Spring MVC, supporting the form handling life cycle
would lead to a lot of custom code, causing effort wastage and difficulties in main-
tenance. However, with Spring, most of the boilerplate code associated with form
life-cycle and command management is provided out of the box.
 
Search WWH ::




Custom Search