What is the difference between internal redirect (request forwarding) and external redirect?

Source: Internet
Author: User

Summarized points:
1. During Internal redirection, requests are actually forwarded to another page or servlet through the server. At this time, the target page or servlet to be redirected can obtain the request object, you can also obtain the attributes and parameters in the request. The external jump is actually the first request, and the server sends a command to the client, asking the client to request the server again, at this time, the request object obtained by the server for the second time is not the request object of the first request, so the parameters and attributes in the first request cannot be obtained.
2. the address bar of the internal jump url will not change, and the external jump url will change.
3. The internal jump cannot jump to jsp or servlet other than the project, but the external jump can.
4. Internal jump implementation method:

Java code
  1. Request. getRequestDispatcher ("XXX. jsp or servlet"). forward (request, response ),
[Java]View plaincopyprint?
  1. Request. getRequestDispatcher ("XXX. jsp or servlet"). forward (request, response ),


External jump implementation method:

Java code
  1. Response. sendRedirect ("XXX. jsp or servlet ").

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.