A lot of people have answered that Model
is an interface while ModelView
is a class implementing Map
interface.
My confusion is what actually implements interface
Model
then? (I am a beginner of Spring MVC so please be patient You can refer to this thread for code hint. What are the differences between Model, ModelMap, and ModelAndView?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. I will present the picture: