1. Request redirection: the client behavior, response. sendredirect (), is essentially equivalent to two requests. The previous request object will not be retained, and the URL address in the address bar will change.
2. Request forwarding: Server behavior. Request. getrequsetdispatcher (). Forward (requset, response) is a request. After forwarding, the request object will be saved and the URL in the address bar will not change. (Internal server forwarding. All clients cannot see the changes in the address bar)
The following is an example of life:
Request redirection: it is like finding an advertisement Company A to design a business card. Company A clearly tells us that they will not design it. Let's look for company B. As a result, Company B has designed it for me, so we will claim to be the business card designed by Company B for US (so we send two requests, from Company A to Company B in the URL address bar)
Request forwarding: I also went to Company A to design the business card. Although Company A could not design it, but they took over our work and outsourced the task to Company B, in the end, we will give the money to Company A and claim that Company A has designed the business card for us. This is request redirection (so we send only one request to Company, company A in the URL address bar ).
The difference between Servlet Request forwarding and redirection ------ the difference between the two is illustrated by living instances