1, ModelAndView
If the return value is springMVC ModelAndView, which contains both the data model, view information is also included.
ModelAndView object may be used in the processing method of a method of adding the model data: addObject (String attributeName, Object attributeValue)
Set View: setView (String viewName)
2, forwarded to the jsp page
Request processing method returns a string, the default server using the internal jump (Forward)
1 return "main";
Redirection, in front of the returned string plus "redirect: /"
1 return "redirect:/main.jsp";
Use ModelAndView object forwarding, forwarding default forward
1 mv.setViewName("main");
ModelAndView objects using redirection
1 mv.setViewName("redirect:/main.jsp");
3, the request is forwarded to the processing method of the controller
Forwarded to the specified method
1 return "forward:/main";
Redirected to the method
1 return "redirect:/main";
Use forwarding ModelAndView
1 mv.setViewName("forward:/main");
Use redirect ModelAndView
1 mv.setViewName("redirect:/main");
Note that, the redirection will re-initiate the request in your browser, you can not access the resource files under WEN-INF. Redirect must be added to the resource file extensions, namely .jsp.