- A+
所属分类:SpringBoot
- 一般的String型返回值
@RequestMapping("/haha") public String haha(HttpServletResponse response){ System.out.println("redirect"); return "redirect:http://www.baidu.com"; }
- void型返回值
@RequestMapping("/gaga") public void gaga(HttpServletResponse response) throws IOException { response.sendRedirect("http://www.baidu.com"); }
- ModelAndView型返回值
@RequestMapping("/hehe") public ModelAndView hehe(ModelAndView mv, HttpServletRequest request){ return new ModelAndView("redirect:http://www.baidu.com"); }