开发者

getModel() vs getModelMap() in ModelAndView

开发者 https://www.devze.com 2022-12-10 20:05 出处:网络
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 act

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消