自动刷新:
1就代表1秒刷新
response.setHeader("refresh","1");
自动跳转:
2秒后跳转到另一个链接
response.setHeader("refresh","2;URL=链接");
完整代码:
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<html>
<body>
时间:<%
out.println(new Date());
response.setHeader("refresh","1");//一秒刷新页面一次 response.setHeader("refresh","1");
//二秒跳到其他页面 response.setHeader("refresh","2;URL=otherPagename");
%>
</body>
</html>