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