Redirects the request to forward the login form

Specific description of the problem

  1. Redirected to the page can not be accessed under the WEB-INF
  2. After you submit the login form into the WEB-INF use when the request is forwarded
  3. After the request is forwarded to refresh the page will re-submit the form
  4. So that even after the return of the Log will log in directly refresh the page again

Solution

Redirect to a method of forwarding the request

  • The original method

      @RequestMapping("/login")
      public String login(){
          return ("admin/index");//请求转发到登陆后的主页
      }
  • ways to improve

      @RequestMapping("/login")
      public String login(){
          return ("redirect:/system/toLogin");//重定向toLogin链接
      }
    
      @RequestMapping("/toLogin")
      public String toLogin(){
          return ("admin/index");//请求转发到登陆后的主页
      }

Guess you like

Origin www.cnblogs.com/yxmhl/p/11601219.html