1.jsp jump from the current page to another page (contains a method for jumping pages using JavaScript, servlet)

Source: Internet
Author: User

There are two common ways to jump pages using JSP

1. Forwarding:forward action ID with execution request forwarding <jsp:forword>

<jsp:forward page="6-5-login.jsp" ></jsp:forward>

2. redirect redirect using the Sendredirect () method of the Response object

<% response.sendredirect ("jsp/login.jsp");%>

The redirect operation supports redirecting addresses to pages on different hosts than the current page, unlike forwarding, for example,

<% response.sendredirect ("www.baidu.com");%>

Their main difference is that one can carry data, one cannot.

The reason is that the next request will be made inside the server after the forwarding is executed, and the data will be returned to the browser.

Redirection is the ability to first respond to the browser and then make a request to the server without carrying the data.

3. Using JavaScript's internal object window's location () method

<script type="Text/javascript" >window.location.href="login.jsp"</Script >

4. As with JSPs, there are two ways that Servlets can jump pages: forward and redirection redirect

Forward
RequestDispatcher rd = Request.getrequestdispatcher ("path.jsp");
Rd.forward (request, response);

  

redirect
Response.sendredirect ("path.jsp");

1.jsp jump from the current page to another page (contains a method for jumping pages using JavaScript, servlet)

Related Article

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.