美文网首页
SpringBoot页面跳转

SpringBoot页面跳转

作者: 沁园Yann | 来源:发表于2019-11-27 19:07 被阅读0次

方法一:

@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();
        }
    }

相关文章

网友评论

      本文标题:SpringBoot页面跳转

      本文链接:https://www.haomeiwen.com/subject/vfrmwctx.html