There is an important difference between redirection and forwarding: When forwarding is used, the JSP container uses an internal method to invoke the target page, and the new page continues to process the same request, and the browser will not know about the process. In contrast, the redirection means that the first page notifies the browser to send a new page request. Because, when you use redirection, the URL displayed in the browser becomes the URL of the new page, and when you use forwarding, the URL stays the same. Redirection is slower than forwarding because the browser has to issue a new request. Also, because of a new request being redirected, the objects within the request will not be available after a redirect.
How do you choose to redirect or forward? Forwarding is usually faster and can keep objects within the request, so he is the first choice. However, since the URL in the browser still points to the start page after forwarding, the start page will be called back if the current page is overloaded. If you do not want to see such a situation, select forward.
The difference between forwarding and redirection
Instead of using the session scope just to pass the variable to the next page, it will increase the scope of the variable for no reason, and forwarding may help you to solve the problem.
Redirect: variables stored in previous request are all invalidated and entered a new request scope.
Forwarding: The variables stored in previous request will not fail, just like putting two pages together.