Which one has to be used when ?
When I see the source code of ModelAndView
class, getModel()
is simpling calling the getModelMap()
, Why are there two different methods doing same activity ?
Which one has to be used when ?
When I see the source code of ModelAndView
class, getModel()
is simpling calling the getModelMap()
, Why are there two different methods doing same activity ?
Backwards compatibility. Earlier versions of Spring only had getModel()
, newer versions added the more explicit getModelMap()
. Note that the return type is slightly different also, getModelMap()
returns the more tightly typed ModelMap
class, rather than a raw pre-java5 Map
.