Below is some simple code.
@RequestMapping(value="/main")
public ModelAndView main(ModelAndView model) {
model.addObject("project",mainService.selectProject());
return null;
}
I thought until now that the role of parameter should be used only in the form of method name (x,y, etc..) elsewhere.
However, when used like the code above, it is not a role that receives a certain value, but rather a "one variable?" or "One constructor?"
It seems to be used like
It can be used as if using new, but I would like to know the principle.
Could you explain the principle or point me to a keyword that I can study?
===
public ModelAndView main(ModelAndView model) {
In the ModelAndView model is this part.
When this part calls the method (ex, method name (x, y))
I was only thinking of it for the purpose of receiving the value of something.
However, the ModelAndView model above can be used as a variable or constructor by itself.
From the line of knowledge I know, ModelAndView model = new ModelAndView(); should be However, this part was omitted and it can be used by declaring it in the parameter.