| java.util.LinkedHashMap org.springframework.ui.ModelMap
ModelMap | public class ModelMap extends LinkedHashMap (Code) | | Implementation of
java.util.Map for use when building model data for use
with UI tools. Supports chained calls and generation of model attribute names.
This class serves as generic model holder for both Servlet and Portlet MVC,
but is not tied to either of those.
author: Rob Harrop author: Juergen Hoeller since: 2.0 See Also: Conventions.getVariableName See Also: org.springframework.web.servlet.ModelAndView See Also: org.springframework.web.portlet.ModelAndView |
Constructor Summary | |
public | ModelMap() Construct a new, empty ModelMap . | public | ModelMap(String attributeName, Object attributeValue) Construct a new ModelMap containing the supplied attribute
under the supplied name. | public | ModelMap(Object attributeValue) Construct a new ModelMap containing the supplied attribute. |
ModelMap | public ModelMap()(Code) | | Construct a new, empty ModelMap .
|
ModelMap | public ModelMap(Object attributeValue)(Code) | | Construct a new ModelMap containing the supplied attribute.
Uses attribute name generation to generate the key for the supplied model
object.
See Also: ModelMap.addAttribute(Object) |
addAttribute | public ModelMap addAttribute(String attributeName, Object attributeValue)(Code) | | Add the supplied attribute under the supplied name.
Parameters: attributeName - the name of the model attribute (never null ) Parameters: attributeValue - the model attribute value (can be null ) |
addAttribute | public ModelMap addAttribute(Object attributeValue)(Code) | | Add the supplied attribute to this Map using a
org.springframework.core.Conventions.getVariableName generated name .
Note: Empty
Collection Collections are not added to
the model when using this method because we cannot correctly determine
the true convention name. View code should check for null rather
than for empty collections as is already done by JSTL tags.
Parameters: attributeValue - the model attribute value (never null ) |
mergeAttributes | public ModelMap mergeAttributes(Map attributes)(Code) | | Copy all attributes in the supplied Map into this Map ,
with existing objects of the same name taking precedence (i.e. not getting
replaced).
|
|
|