getModel() vs getModelMap() in ModelAndView
Which one has to be used when ?
When I see the source code of ModelAndView
class, getModel()
is simpling calling the getModelMap()
, W开发者_如何学运维hy 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
.
精彩评论