GetModel () vs getModelMap () in ModelAndView

Which one should I use when?

When I see the source code of a class ModelAndView, getModel()it makes it easier to call getModelMap(), why are there two different methods that perform the same activity?

+3
source share
1 answer

Backward compatibility. Earlier versions of Spring only had getModel()newer versions added more explicit getModelMap(). Note that the return type is slightly different and getModelMap()returns a more strongly typed ModelMapclass, rather than raw pre-java5 Map.

+3
source

Source: https://habr.com/ru/post/1722422/


All Articles