ZPY博客

SpirngBoot重定向到其它系统的几种方式

@RequestMapping("/haha")
public String  haha(HttpServletResponse response){
    System.out.println("redirect");
    return "redirect:http://www.baidu.com";
}
@RequestMapping("/gaga")
    public void  gaga(HttpServletResponse response) throws IOException {
        response.sendRedirect("http://www.baidu.com");
    }
@RequestMapping("/hehe")
    public ModelAndView hehe(ModelAndView mv, HttpServletRequest request){
      return new ModelAndView("redirect:http://www.baidu.com");
    }