SpringBoot页面跳转
2019-11-27 本文已影响0人
沁园Yann
方法一:
@RequestMapping("/go1")
public String go1(){
return "redirect:" + url;
}
方法二:
@RequestMapping("/go2")
public ModelAndView go2(){
return new ModelAndView("redirect:" + url);
}
方法三:
@RequestMapping("/go3")
public void go3(HttpServletResponse response){
try {
response.sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}