设为首页 加入收藏

TOP

基于springMVC 3.0项目开发实例(四)
2014-11-23 19:17:51 】 浏览:1846
Tags:基于 springMVC 3.0 项目 开发实例
be resolved

* by the DispatcherServlet's ViewResolver

* @see #addObject

*/

public ModelAndView(String viewName) {

this.view = viewName;

}

/**

* Convenient constructor when there is no model data to expose.

* Can also be used in conjunction withaddObject.

* @param view View object to render

* @see #addObject

*/

public ModelAndView(View view) {

this.view = view;

}

/**

* Creates new ModelAndView given a view name and a model.

* @param viewName name of the View to render, to be resolved

* by the DispatcherServlet's ViewResolver

* @param model Map of model names (Strings) to model objects

* (Objects). Model entries may not benull, but the

* model Map may be null if there is no model data.

*/

public ModelAndView(String viewName, Map model) {

this.view = viewName;

if (model !=null) {

getModelMap().addAllAttributes(model);

}

}

/**

* 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

* @param view View object to render

* @param model Map of model names (Strings) to model objects

* (Objects). Model entries may not benull, but the

* model Map may be null if there is no model data.

*/

public ModelAndView(View view, Map model) {

this.view = view;

if (model !=null) {

getModelMap().addAllAttributes(model);

}

}

/**

* Convenient constructor to take a single model object.

* @param viewName name of the View to render, to be resolved

* by the DispatcherServlet's ViewResolver

* @param modelName name of the single entry in the model

* @param modelObject the single model object

*/

public ModelAndView(String viewName, String modelName, Object modelObject) {

this.view = viewName;

addObject(modelName, modelObject);

}

/**

* Convenient constructor to take a single model object.

* @param view View object to render

* @param modelName name of the single entry in the model

* @param modelObject the single model object

*/

public ModelAndView(View view, String modelName, Object modelObject) {

this.view = view;

addObject(modelName, modelObject);

}

/**

* 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.

*/

publicvoid setViewName(String viewName) {

this.view = viewName;

}

/**

* Return the view name to be resolved by the DispatcherServlet

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

*/

public String getViewName() {

return (this.viewinstanceof String (String) this.view :null);

}

/**

* Set a View object for this ModelAndView. Will override any

* pre-existing view name or View.

*/

publicvoid setView(View view) {

this.view = view;

}

/**

* Return the View object, ornull if we are using a view name

* to be resolved by the DispatcherServlet via a ViewResolver.

*/

public View getView() {

return (this.viewinstanceof View (View) this.view :null);

}

/**

* Indicate whether or not thisModelAndView has a view, either

* as a view name or as a direct{@link View} instance.

*/

publicboolean hasView() {

return (this.view != null);

}

/**

* 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.

*/

publicboolean isReference() {

return (this.viewinstanceof String);

}

/**

* Return the model map. May returnnull.

* Called by DispatcherServlet for eva luation of the model.

*/

protected Map getModelInternal() {

returnthis.model;

}

/**

* Return the underlying ModelMap instance (neve

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 4/8/8
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇ftk学习记(list篇) 下一篇策略模式Strategy――回家乘什么..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目