(1)JavaWeb定时刷新与定时跳转
package responsePrint;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RefreshServlet extends HttpServlet{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 2秒后刷新并跳转到百度首页
resp.setHeader("Refresh", "2;URL=https:baidu.com");
// 每隔3秒刷新一次
resp.setHeader("Refresh","3");
}
}