* model Map may be null if there is no model data. */ public ModelAndView(String viewName, Map<String, ?> model) { this.view = viewName; if (model != null) { getModelMap().addAllAttributes(model); } } /** * Creates new ModelAndView given a View object and a mod...
* @param 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. */ publicModelAndView(View view, Map<String, ?> model) { this.view = view; if(model !=null) { getModelMap()....
public ModelMap getModel() { if (useDefaultModel()) { // 使用默认视图 return this.defaultModel; } else { if (this.redirectModel == null) { // 若重定向视图为null,就new一个空的返回 this.redirectModel = new ModelMap(); } return this.redirectModel; } } // @since 4.1.4 public Mod...
ModelMap getModelMap() //返回底层ModelMap实例(从不为null) View getView() //返回View对象,或者为null,如果我们使用的视图名称由通过一个ViewResolverDispatcherServlet会得到解决 String getViewName() //返回视图名称由DispatcherServlet的解决,通过一个ViewResolver,或空,如果我们使用的视图对象 boolean hasView(...
{return null;}ModelMap model = mavContainer.getModel();ModelAndView mav = new ModelAndView(mavContainer.getViewName(), model, mavContainer.getStatus());// 真正的View 可见ModelMap/视图名称、状态HttpStatus最终都交给了Veiw去渲染if (!mavContainer.isViewReference()) {mav.setView((View) mav...
简介:ModelAndViewContainer、ModelMap、Model、ModelAndView详细介绍【享学Spring MVC】(中) 2、setRequestHandled()方法的使用 作为设置方法,调用的地方有好多个,总结如下: AsyncTaskMethodReturnValueHandler:处理返回值类型是WebAsyncTask的方法 // 若返回null,就没必要继续处理了if (returnValue == null) {mavContainer...
{returnnull;}ModelMap model=mavContainer.getModel();ModelAndView mav=newModelAndView(mavContainer.getViewName(),model,mavContainer.getStatus());// 真正的View 可见ModelMap/视图名称、状态HttpStatus最终都交给了Veiw去渲染if(!mavContainer.isViewReference()){mav.setView((View)mavContainer.getView());...
他的实现类为RedirectAttributesModelMap,同样继承自ModelMap,内部成员有DataBinder数据用于数据绑定,flashAttributes则是另一个Map,保存着重定向的属性。 该类构造时直接传入一个数据绑定器,可为null,RedirectAttributesModelMap(org.springframework.validation.DataBinderdataBinder) ...
public boolean isViewReference() { return (this.view instanceof String); } // 是否使用默认的Model private boolean useDefaultModel() { return (!this.redirectModelScenario || (this.redirectModel == null && !this.ignoreDefaultModelOnRedirect)); ...
.view=view;}@NullablepublicViewgetView(){returnthis.view instanceof View?(View)this.view:null;}publicbooleanhasView(){returnthis.view!=null;}publicbooleanisReference(){returnthis.view instanceof String;}@NullableprotectedMap<String,Object>getModelInternal(){returnthis.model;}publicModelMapgetModel...