Logic: Forward

Source: Internet
Author: User

I think it is easier to compare the forward and redirect actions. For this reason, we will also introduce the logic: Forward and logic: Redirect tags here.

Let's take a look at the differences between the two actions:

Forward is executed within the servlet. the browser will not perceive this action at all, and the original URL will not change. If the browser reloads, it will simply repeat the original request.
Redirect is divided into two steps: the first step is that the Web application tells the browser the second URL, and then the browser sends a request to the second URL.
Redirect is slower than forward because the browser requires a second request. Note that the bean in the first request scope is invisible to the second request.

After understanding the differences described above, you will know when to choose the logic: Forward label and when to choose the logic: Redirect label. Logic: the forward label completes pagecontext. Forward () or httpservletresponse. sendredirect (). The Controller determines how to choose. Logic: the Redirect label completes httpservletresponse. sendredirect ().

When using the logic: Redirect tag, we can construct baseurl and query parameters like HTML: link. If you are interested, refer to HTML: link tag.

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.