ModelAndView

ModelAndView
ModelAndView

摘要:嵌套 | 字段 | 构造方法 | 方法详细信息:字段 | 构造方法 | 方法

org.springframework.web.servlet

类 ModelAndView

https://www.360docs.net/doc/d013917490.html,ng.Object

org.springframework.web.servlet.ModelAndView

public class ModelAndView

extends https://www.360docs.net/doc/d013917490.html,ng.Object

两个模型和视图持有人在Web MVC框架。请注意,这些是完全不同的。这个类只是认为既可以使得一个控制器返回一个返回值都模型和视图。

表示一个模型和视图的处理程序返回的,要解决的DispatcherServlet的。据认为可以采取一个字符串的视图名称,将需要由一个ViewResolver对象解决形式;另外一个视图对象可以直接指定。该模型是一个地图,允许按名称键入多个对象使用。

英文注释

Holder for both Model and View in the web MVC framework. Note that these are entirely distinct. This class merely holds both to make it possible for a controller to return both model and view in a single return value.

Represents a model and view returned by a handler, to be resolved by a DispatcherServlet. The view can take the form of a String view name which will need to be resolved by a ViewResolver object; alternatively a View object can be specified directly. The model is a Map, allowing the use of multiple objects keyed by name.

作者:

Rod Johnson, Juergen Hoeller, Rob Harrop

另请参见:

DispatcherServlet, ViewResolver,

HandlerAdapter.handle(javax.servlet.http.HttpServletRequest,

javax.servlet.http.HttpServletResponse, https://www.360docs.net/doc/d013917490.html,ng.Object),

Controller.handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

ModelAndView

public ModelAndView()

默认构造函数豆式的用法:在构造函数参数填充通过bean属性代替。

英文注释

Default constructor for bean-style usage: populating bean

properties instead of passing in constructor arguments.

另请参见:

setView(View), setViewName(String)

ModelAndView

public ModelAndView(https://www.360docs.net/doc/d013917490.html,ng.String viewName)

方便在没有构造模型数据暴露。也可一起使用,在addObject 。

参数:

viewName - 视图的名称来呈现,要解决的DispatcherServlet的视图解

析器

英文注释

Convenient constructor when there is no model data to expose. Can also be used in conjunction with addObject.

viewName - name of the View to render, to be resolved by the

DispatcherServlet's ViewResolver

另请参见:

addObject(https://www.360docs.net/doc/d013917490.html,ng.String, https://www.360docs.net/doc/d013917490.html,ng.Object)

ModelAndView

public ModelAndView(View view)

方便在没有构造模型数据暴露。也可一起使用,在addObject 。

参数:

view - View对象呈现

英文注释

Convenient constructor when there is no model data to expose. Can also be used in conjunction with addObject.

view - View object to render

另请参见:

addObject(https://www.360docs.net/doc/d013917490.html,ng.String, https://www.360docs.net/doc/d013917490.html,ng.Object)

ModelAndView

public ModelAndView(https://www.360docs.net/doc/d013917490.html,ng.String viewName,

java.util.Map model)

创建新的视图名称ModelAndView的给予和模型。

参数:

viewName - 查看名称呈现,要解决的DispatcherServlet的的的

ViewResolver

model - 地图的型号名称(字符串)模型对象(对象)。示范项目不得

null ,但是模型地图,可 null ,如果没有模型数据。

英文注释

Creates new ModelAndView given a view name and a model.

viewName - name of the View to render, to be resolved by the

DispatcherServlet's ViewResolver

model - Map of model names (Strings) to model objects (Objects).

Model entries may not be null, but the model Map may be null if there is no model data.

ModelAndView

public ModelAndView(View view,

java.util.Map model)

创建新的ModelAndView给予视图对象和模型。注:所提供的模型数据被复制到这个类的内部存储。你不应该考虑修改后提供给这个类所提供的地图

参数:

view - View对象呈现

model - 地图的型号名称(字符串)模型对象(对象)。示范项目不得

null ,但是模型地图,可 null ,如果没有模型数据。

英文注释

Creates new ModelAndView given a View object and a model. Note: the supplied model data is copied into the internal storage of this class. You should not consider to modify the supplied Map after supplying it to this class

view - View object to render

model - Map of model names (Strings) to model objects (Objects).

Model entries may not be null, but the model Map may be null if there is no model data.

ModelAndView

public ModelAndView(https://www.360docs.net/doc/d013917490.html,ng.String viewName,

https://www.360docs.net/doc/d013917490.html,ng.String modelName,

https://www.360docs.net/doc/d013917490.html,ng.Object modelObject)

方便的构造采取单一的模式对象。

参数:

viewName - 查看名称呈现,要解决的DispatcherServlet的的的

ViewResolver

modelName - 名称的模式单一条目

modelObject - 单一模型对象

英文注释

Convenient constructor to take a single model object.

viewName - name of the View to render, to be resolved by the

DispatcherServlet's ViewResolver

modelName - name of the single entry in the model

modelObject - the single model object

ModelAndView

public ModelAndView(View view,

https://www.360docs.net/doc/d013917490.html,ng.String modelName,

https://www.360docs.net/doc/d013917490.html,ng.Object modelObject)

方便的构造采取单一的模式对象。

参数:

view - View对象呈现

modelName - 名称的模式单一条目

modelObject - 单一模型对象

英文注释

Convenient constructor to take a single model object.

view - View object to render

modelName - name of the single entry in the model

setViewName

public void setViewName(https://www.360docs.net/doc/d013917490.html,ng.String viewName)

设定此ModelAndView的视图的名称,要通过解决一个ViewResolver

DispatcherServlet的。将覆盖任何预先存在的视图名称或查看。

英文注释

Set a view name for this ModelAndView, to be resolved by the

DispatcherServlet via a ViewResolver. Will override any

pre-existing view name or View.

getViewName

public https://www.360docs.net/doc/d013917490.html,ng.String getViewName()

返回视图名称有待解决的ViewResolver,或由DispatcherServlet的通

过一个null ,如果我们使用的是View对象。

英文注释

Return the view name to be resolved by the DispatcherServlet via

a ViewResolver, or null if we are using a View object. setView

public void setView(View view)

设定此ModelAndView的视图对象。将覆盖任何预先存在的视图名称或查

看。

英文注释

Set a View object for this ModelAndView. Will override any

pre-existing view name or View.

getView

public View getView()

返回View对象,或者null ,如果我们使用一个视图名称有待解决的的

ViewResolver DispatcherServlet的通过。

英文注释

Return the View object, or null if we are using a view name to be resolved by the DispatcherServlet via a ViewResolver.

hasView

public boolean hasView()

说明是否此ModelAndView具有直接的一个观点,无论是作为一个视图的

名称或View实例。

英文注释

Indicate whether or not this ModelAndView has a view, either as a view name or as a direct View instance.

isReference

public boolean isReference()

返回是否使用视图的引用,即true ,如果认为已经通过名称指定

DispatcherServlet的解决要通过一个ViewResolver。

英文注释

Return whether we use a view reference, i.e. true if the view has been specified via a name to be resolved by the DispatcherServlet via a ViewResolver.

getModelMap

public ModelMap getModelMap()

返回底层ModelMap实例(永远null )。

英文注释

Return the underlying ModelMap instance (never null). getModel

public java.util.Map getModel()

返回模式图。永远不会返回null 。被称为应用程序代码的修改模型。

英文注释

Return the model map. Never returns null. To be called by

application code for modifying the model.

addObject

public ModelAndView addObject(https://www.360docs.net/doc/d013917490.html,ng.String attributeName,

https://www.360docs.net/doc/d013917490.html,ng.Object attributeValue) 添加一个属性到模型中。

参数:

attributeName - 对象名称添加到模型

attributeValue - 对象添加到模型中(永不null )

英文注释

Add an attribute to the model.

attributeName - name of the object to add to the model

attributeValue - object to add to the model (never null)

另请参见:

ModelMap.addAttribute(String, Object), getModelMap()

addObject

public ModelAndView addObject(https://www.360docs.net/doc/d013917490.html,ng.Object attributeValue) 将属性添加到模型中使用的参数名生成。

参数:

attributeValue - 添加到对象模型(永远null )

英文注释

Add an attribute to the model using parameter name generation.

attributeValue - the object to add to the model (never null)

另请参见:

ModelMap.addAttribute(Object), getModelMap()

addAllObjects

public ModelAndView addAllObjects(java.util.Map modelMap) 新增模式。所载的所有属性在提供地图的

参数:

modelMap - 地图的属性名称“ - >的AttributeValue对

英文注释

Add all attributes contained in the provided Map to the model.

modelMap - a Map of attributeName -> attributeValue pairs

另请参见:

ModelMap.addAllAttributes(Map), getModelMap()

clear

public void clear()

明确了这个ModelAndView对象的状态。该对象将是空的之后。

可以被用来镇压对象呈现给定的ModelAndView在postHandle

HandlerInterceptor的方法一。

英文注释

Clear the state of this ModelAndView object. The object will be empty afterwards.

Can be used to suppress rendering of a given ModelAndView object in the postHandle method of a HandlerInterceptor.

另请参见:

isEmpty(),

HandlerInterceptor.postHandle(javax.servlet.http.HttpServletReq

uest, javax.servlet.http.HttpServletResponse, https://www.360docs.net/doc/d013917490.html,ng.Object, org.springframework.web.servlet.ModelAndView)

isEmpty

public boolean isEmpty()

回报是空的,即它是否已不抱任何看法,不包含模型是否ModelAndView

对象。

英文注释

Return whether this ModelAndView object is empty i.e. whether it does not hold any view and does not contain a model.

wasCleared

public boolean wasCleared()

返回ModelAndView对象是否是空的号召结果以clear()即是否不持有任

何意见,不包含模型。返回 false ,如果任何其他国家加入后,调用该

实例clear()。

英文注释

Return whether this ModelAndView object is empty as a result of a call to clear()i.e. whether it does not hold any view and does not contain a model. Returns false if any additional state was added to the instance after the call to clear().

另请参见:

clear()

toString

public https://www.360docs.net/doc/d013917490.html,ng.String toString()

返回诊断信息,该模型和视图。

英文注释

Return diagnostic information about this model and view.

覆盖:

类 https://www.360docs.net/doc/d013917490.html,ng.Object 中的 toString

摘要:嵌套 | 字段 | 构造方法 | 方法详细信息:字段 | 构造方法 | 方法

注意:本文档非官方出品只供参考之用。中文部分非人工翻译未免有词不达意之处,请以英文部分为准。

7-sun 工作室测试制作内容有多处错误,未经同意请勿转载

相关主题
相关文档
最新文档