Share the redirection method on the jsp page

Source: Internet
Author: User

1. Descending jump per second
Copy codeThe Code is as follows:
<Script language = javascript>
Function out (obj ){
Var I = obj;
If (I = 0)
Document. location. href = "index. jsp ";
Document. body. innerHTML = I;
I --;
SetTimeout ("out (" + I + ")", 1000 );
}
</Script>
<Body onload = "out (5);">
</Body>

2. Use the response. setHeader Function
Copy codeThe Code is as follows:
<% Response. setHeader ("Refresh", "5; URL =..."); %>

3. Use meta tags
Copy codeThe Code is as follows:
<META HTTP-EQUIV = "REFRESH" CONTENT = "2"; url = xxxx. jsp ">


JSP page for automatic jump!
1. automatic page Refresh:

Add the following code to the Copy codeThe Code is as follows:
<Meta http-equiv = "refresh" content = "5">

Note: content = "5" is a time control, indicating that the page is refreshed every 5 seconds.

Ii. automatic page Jump:

Add the following code to the Copy codeThe Code is as follows:
<Meta http-equiv = "refresh" content = "1; url = index. jsp">

Note: content = "1 is the time control, indicating that the page to jump is automatically redirected in 1 second.
Content = "0" indicates that the page will jump to the page you want to jump to immediately.
Url = index. jsp is the page to jump

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.