Forward and redirect, forwardredirectForward and redirect
1. Use the forward method
Request. getRequestDispatcher (path). forward (request. response );First, let's take a look at the getRequestDispatcher method. The path must be a relative
This time, you can select your favorite color on the homepage to go to the corresponding page.
Select green to go to the green page:
Select red to go to the Red Page:
Okay. Here we will see four pages:
Select the color in index. jsp and click the
Introduction
Part 2 describes how to use Sajax, PHP, and JavaScript to develop basic albums. In the process of building a history stack for an application, we will rely on the Client technology and directly combine it with Part 1 of the Code. This
PushState, replaceState, and onpopstate are used to refresh the Ajax page forward and backward. history. replacestate
Ajax can be used to obtain data asynchronously and render pages more efficiently.
However, these problems also exist:
Refresh the
Using AJAX, you can get data asynchronously and render the page more efficiently.
But there are also these problems:
Refresh the page, the page will become the initial state
The browser's forward back function is invalid
Crawler crawling on
Introduction Part 1 describes how to use Sajax, PHP, and JavaScript to develop basic albums. In the process of creating a history stack for a program, we will attach the client technique and associate it directly with Part 1 of the code. This
I. Article 1Both the Httpservletresponse.sendredirect and Requestdispatcher.forward methods can be implemented to obtain the appropriate URL resources.Sendredirect implements request redirection, forward implements request forwarding.The processing
Response in JSP. sendredirect () and request. getrequestdispatcher (). both the forward (request, response) objects can redirect pages, but there is a big difference between the two objects. In terms of separation, there are the following
I worked on several part-time jobs and made an ajax request when I completed the page. When the browser is refreshed, the forward button becomes invalid. As a result, google. Jquery. history. js plug-in to be used
On the shoulders of giants, the
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.