转载:https://blog.csdn.net/violet_echo_0908/article/details/50951141
1. return modelAndView例子
@RequestMapping(value="/login", method=RequestMethod.GET)
public ModelAndView loginPage(HttpSession session) {
ModelAndView modelAndView = new ModelAndView("user/login");
return modelAndView; //访问 WEB-INF/jsp/user/login.jsp文件
}
2. return “redirect:/index.jsp”例子
@RequestMapping(value="/", method=RequestMethod.GET)
public String index(HttpSession session){
session.setAttribute("message", null);
return "redirect:/index.jsp"; 访问根目录下index.jsp文件。redirect为直接url 访问。
}