public class ModelAndView extends Object
Constructor and Description |
---|
ModelAndView(String view)
Creates a new model and view.
|
ModelAndView(String view,
Map<String,Object> model)
Creates a new model and view.
|
Modifier and Type | Method and Description |
---|---|
Locale |
getLocale()
Returns the locale used when rendering the view.
|
Map<String,Object> |
getModel()
View data (a.k.a as model).
|
String |
getView()
View name with file extension, like:
index.html . |
ModelAndView |
put(Map<String,Object> attributes)
Copy all the attributes into the model.
|
ModelAndView |
put(String name,
Object value)
Put a model attribute.
|
ModelAndView |
setLocale(Locale locale)
Sets the locale used when rendering the view, if the template
engine supports setting it.
|
String |
toString() |
public ModelAndView(@Nonnull String view, @Nonnull Map<String,Object> model)
view
- View name must include file extension.model
- View model.public ModelAndView put(@Nonnull String name, Object value)
name
- Name.value
- Value.public ModelAndView put(@Nonnull Map<String,Object> attributes)
attributes
- Attributes.public ModelAndView setLocale(@Nullable Locale locale)
null
triggers a
fallback to a locale determined by the current request.locale
- The locale used when rendering the view.public Map<String,Object> getModel()
public String getView()
index.html
.index.html
.@Nullable public Locale getLocale()
null
, which triggers a fallback to a locale
determined by the current request.Copyright © 2022. All rights reserved.