Spring Boot重定向的使用方法

Posted 捏不死的小蚂蚁

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring Boot重定向的使用方法相关的知识,希望对你有一定的参考价值。

 1 @RequestMapping(value = "/redirect", method = RequestMethod.GET)
 2     public void redirecttest(@RequestParam(value = "account",required=false) String account,
 3                              @RequestParam(value = "pwd",required=false) String pwd,
 4                              HttpServletRequest request,
 5                              HttpServletResponse response) throws IOException {
 6         log.info(request.getHeader("Host"));
 7         if(account.equals("[email protected]") && pwd.equals("123456")){
 8             response.sendRedirect("http://www.baidu.com");
 9         }
10     }

 

以上是关于Spring Boot重定向的使用方法的主要内容,如果未能解决你的问题,请参考以下文章