<%response.AddHeader "Refresh","3;url=http://www.lvwt.cn" %>
<%Response.Redirect("http://www.youkuaiyun.com")%>
Response Headers Value
(Status-Line) HTTP/1.1 200 OK
Cache-Control private
Date Wed, 11 Apr 2007 09:28:39 GMT
Content-Type text/html
Server Microsoft-IIS/6.0
X-Powered-By ASP.NET
Refresh 3;url=http://www.lvwt.cn
Set-Cookie ASPSESSIONIDQCCCDTQS=GMOFKIBCLEBDJBNMJCKDFDID; path=/
Content-Encoding gzip
Vary Accept-Encoding
Transfer-Encoding chunked
增到头文件中, http head中, 连流览器的stop按钮也无法阻止其转向
==================================
<meta http-equiv="refresh" content="20;URL=../count.asp" />正在转向....
需先下载,然后再利用流览器解释html的作用,再转向
window.location.href="http://www.hao123.com"
===============================
1。用response实现页面转向
例子 jspTest1.jsp(3秒后转到另一页面)
<html>
<body>
<%response.setHeader("Refresh","3;url=http://www.lvwt.cn");%>
3秒后转到http://www.lvwt.cn
</body>
</html>
2。定时刷新
例子 jsptest2.jsp(3秒后刷新)
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.util.Date" %>
<html>
<head> <title>本页用来说明response对象----定时刷新页面</title> </head>
<body>
<b>当前时间为:</b>
<% response.setHeader("refresh","3"); %>
<% out.println(new Date());%>
</body>
</html>
3。用html实现页面转向
例子 htmlTest.htm
<html>
<meta http-equiv="refresh" content="3;url=http://www.lvwt.cn">
<body>
3秒后转到http://www.lvwt.cn
</body>
</html>
4.sendRedirect(“URL”) 重定向
例子 文件1 jspSend1.jsp
<html>
<head><title>请选择</title></head>
<body>
<b>请选择</b><br>
<form action="jspSend2.jsp" method=“get">
<select name="where">
<option value="blog1" selected>go to blog1
<option value="blog2" > go to blog2
<option value="blog3" > go to blog2
</select>
<input type="submit" value="确定">
</form>
</body></html>
文件2 jspSend2.jsp
<html>
<head><title>你想去</title></head>
<body>
<%String address = request.getParameter("where");
if(address.equals("blog1"))
response.sendRedirect("http://www.lvwt.cn");
else if(address.equals("blog2"))
response.sendRedirect("http://lvwt.anyp.cn");
else if(address.equals("blog3"))
response.sendRedirect("http://lvwt.anyp.cn/default.aspx");
%>
</body>
</html>