Theme Resolution
In very similar style to the ResourceBundleViewResolverexplained in the preceding section,
the ResourceBundleThemeSourcealso deals with resource bundles. You can create a winter_fr.
propertiesfile, for example, that points to theme resources using French text or images and
styles.
Bind Support
Bindingis the term given to Spring’s method of mapping request parameters to domain or
command objects. You will most commonly encounter this when dealing with forms in your
web pages.
Recap of Binding and Validation Sequence
Unlike Struts, Spring MVC allows you to use any object you like as a command object without
constraints on its inheritance or interface implementation. When configuring a command
controller, you simply specify the class of the object that will be used to receive the POSTed
items from the form.
After form submission from the browser, the work flow can become quite complex and
diverse because it depends on many factors. But in the simplest cases, Spring’s command
“controller hierarchy will take care of the following:
•Instantiating an object from the class you specify as your command class
•Mapping the POST parameters onto fields in your class (automaticallyperforming
conversions from Strings to primitives, or to any other type for which there is
PropertyEditorsupport)
•Validating your populated command object with a Validatorobject that you have
specified
•Calling an onSubmit()or doSubmitAction()method, supplying the command object
and its validation errors as parameters
•Exposing a “status” object on request that can be accessed from tag libraries and
macros containing pertinent information about any given field on your command
object such as its name, value, and any validation errors associated with it
Bind Support in View Templates
Bind support in views is currently available via tag libraries for JSP/JSTL views and via macros
for Velocity and FreeMarker views. Chapter 8 contains more detail on how to use the
tags or macros for these specific technologies.
CHAPTER 7 ■THE VIEW LAYER 221