首页 > 代码库 > response的setHeader的几种用法

response的setHeader的几种用法

<%@page contentType="text/html;charset=GBK" import="java.util.*" pageEncoding="GBK"%>

 

<% 

  response.setHeader("refresh","5");//第一种:每隔五秒钟页面自动刷新一次

  response.setHeader("refresh","5;url=index.jsp");//第二种:设置浏览器延时跳转

  Date now = new Date();

  out.print(now);

  //不缓存当前页面

  response.setHeader("Pragma","No-cache");

  response.setHeader("Cache-Control","no-cache");

%>