Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3747

What is the actual implementation of Model in Spring MVC

$
0
0

A lot of people have answered that Model is an interface while ModelView is a class implementing Map interface.

  1. My confusion is what actually implements interface Model then? (I am a beginner of Spring MVC so please be patientYou can refer to this thread for code hint.What are the differences between Model, ModelMap, and ModelAndView?

  2. More interestingly, I saw someone just use Map<> interface:

// When the path is routed to '/new' below method to be called and view //returned is newPokemon    @RequestMapping(method = RequestMethod.GET, value ="/new")        public String newPokemonForm(Map<String, Object> model) {        Pokemon Pokemon = new Pokemon();        model.put("pokemon", Pokemon);        return "newPokemon";    }

So I am thinking for this model parameter, Map<> should be declared type while modelmap is the actual type?Can anyone clarify with me?Thanks a lot

----------------------------------Update----------------------------

For the first question, actually it is easy to check in Intellij. Just open the source code package thanks to Elmar Brauch. see screenshot below:screenshot of finding the related source code


Viewing all articles
Browse latest Browse all 3747

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>