Home > Java > javaTutorial > body text

What are JSP forwarding and redirection

(*-*)浩
Release: 2020-09-14 14:49:20
Original
4101 people have browsed it

What are JSP forwarding and redirection

JSP redirection and forwarding are both request methods in JSP, which can be used according to different situations.

Recommended courses: Java tutorial

Forwarding:

When the client request is submitted to the server's jsp for processing

This jsp can carry the request and response objects and transfer them to another place in the web application for processing

After processing at another place, the result page response is generated to the client browser

At this time, the client browser can see the result page, but the URL has not changed

So I don’t know how many layers of processing the server has gone through

Redirect:

When the client browser submits it to the server's JSP for processing

This JSP returns a response: to request another URL

At this time, the client browser will send it again A new request goes to this new address

The new URL address is responsible for generating a response for the browser

The URL the browser sees at this time is the URL address corresponding to the second request

The difference between the two

Selection of forwarding and redirection

Redirection is slower than forwarding because the browser You have to issue a new request. If it doesn't matter whether you use forwarding or redirection, it is recommended to use forwarding.

Because forwarding can only access the current WEB application, so when accessing between different WEB applications, especially when accessing resources on another WEB site, you can only use redirection at this time. .

The above is the detailed content of What are JSP forwarding and redirection. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
jsp
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!