The RequestMapping methods support a varied range of return types. Thinking conceptually, a request mapping method should answer two questions:
- What's the view?
- What's the model that the view needs?
However, with Spring MVC, the view and model need not be explicitly declared at all times:
- If a view is not explicitly defined as part of the return type, then it is implicitly defined.
- Similarly, any model object is always enriched as detailed in the rules below.
Spring MVC uses simple rules to determine the exact view and model. A couple of important rules are listed as follows:
- Implicit enriching of the Model: If a model is part of the return type, it is enriched with command objects (including ...