@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2008 the original author or authors .
* Copyright 2002 - 2009 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -19,6 +19,7 @@ package org.springframework.web.servlet;
@@ -19,6 +19,7 @@ package org.springframework.web.servlet;
import java.util.Map ;
import org.springframework.ui.ModelMap ;
import org.springframework.util.CollectionUtils ;
/ * *
* Holder for both Model and View in the web MVC framework .
@ -51,7 +52,7 @@ public class ModelAndView {
@@ -51,7 +52,7 @@ public class ModelAndView {
/ * *
* Indicates whether or not this instance has been cleared with a call to { @link # clear ( ) } .
* /
private boolean cleared ;
private boolean cleared = false ;
/ * *
@ -267,17 +268,17 @@ public class ModelAndView {
@@ -267,17 +268,17 @@ public class ModelAndView {
}
/ * *
* Return whether this ModelAndView object is empty
* Return whether this ModelAndView object is empty ,
* i . e . whether it does not hold any view and does not contain a model .
* /
public boolean isEmpty ( ) {
return ( this . view = = null & & this . model = = null ) ;
return ( this . view = = null & & CollectionUtils . isEmpty ( this . model ) ) ;
}
/ * *
* Return whether this ModelAndView object is empty as a result of a call to { @link # clear }
* i . e . whether it does not hold any view and does not contain a model .
* Returns < code > false < / code > if any additional state was added to the instance
* < p > Returns < code > false < / code > if any additional state was added to the instance
* < strong > after < / strong > the call to { @link # clear } .
* @see # clear ( )
* /