How to use ssm for request forwarding and redirection

Request forwarding : carry data and complete on the server side

  • Forward to the page, the following will be forwarded to the success.jsp page
        return "success";

 

  • Forward to another controller, forward to processing method.
        return "forward:/BookListredirect";

 

Redirection : The client is done, so the path is written differently

  • Redirect to page
      return "redirect:/day14/success.jsp";
  • Redirect to another controller, redirect to the processing method.
      return "redirect:/BookListredirect";

Summary: To methods: forward and redirect+method path
           to the page, redirect is the relative path of the page, and forward is the name of the jsp page.

 

 

 

Guess you like

Origin blog.csdn.net/qq_41071754/article/details/111065839