1, Request redirect: Client behavior, Response.sendredirect (), essentially equivalent to two requests, the previous request object will not be persisted, the Address bar URL will change.
2, Request Forwarding: Server behavior, Request.getrequsetdispatcher (). Forward (requset,response); is a request, the request object will be saved after forwarding, the Address bar URL address will not change. (Server internal forwarding, all clients do not see the change in the address bar)
Here is an example of life that illustrates:
Request redirection: Just like we find a advertising company to design business cards, a clearly tell us that they will not design, let us find B company, the result B company designed for me, so we will announce the company B to us the design of the business card, (so we are equivalent to send two times the request, The URL address bar has changed from A to Company B)
Request Forwarding: Also to find a company to design business cards, although a company can not design but they took our lives, the task of outsourcing (forwarding) to company B, and eventually we will give money to company A, It's going to be a business card designed by company A. This is the request redirection (so we're just sending a single request to a, and the URL address bar is still company a).
Java Forwarding and redirection