spring mvc 页面跳转

在spring mvc中实现在Controller中进行页面跳转有两种方式
1.
public ModelAndView login(HttpServletResponse response, String id) {
response.sendRedirect("index.do="+id);
return null;
}

2.
public ModelAndView login(HttpServletResponse response, String id) {

return new ModelAndView("redirect:index.do="+id);
}

 

你可能感兴趣的:(java,spring,mvc)