在以下代码中,
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");
}`
value=""
,@ModelAttribute()
和return new ModelAndView()
到底能做什么?
value="add-location"
的角色与@ModelAndView("addLocation")
的第一个参数有何不同?
答案 0 :(得分:0)
我认为您需要学习一些basic example(您可以找到许多其他教程,我只是其中之一)。