In the following code,
snapshot of @RequestMapping method
`// Get addLocation.jsp.
@RequestMapping(value="/add-location", method=RequestMethod.GET)
public ModelAndView addLocationJSP() {
System.out.println("Location: LocationController.addLocationJSP()");
return new ModelAndView("addLocation", "location", new Location());
}
// Submit addLocation.jsp form.
@RequestMapping(value="/submit-location", method=RequestMethod.POST)
public ModelAndView submitLocation(@ModelAttribute("location") Location location) {
System.out.println("Location: LocationController.submitLocation()");
locationService.saveLocation(location);
return new ModelAndView("confirmSubmit");
}`
what, exactly, do value=""
, @ModelAttribute()
, and return new ModelAndView()
do?
How is the role of value="add-location"
different from the first argument of @ModelAndView("addLocation")
?