如何将页面设置为过期

	  	HttpServletResponse response = ServletActionContext.getResponse();
		//将过期日期设置为一个过去时间 
		response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT"); 
		// 设置 HTTP/1.1 no-cache 头 
		response.setHeader("Cache-Control", "no-store,no-cache,must-revalidate"); 
		// 设置 IE 扩展 HTTP/1.1 no-cache headers, 用户自己添加 
		response.addHeader("Cache-Control", "post-check=0, pre-check=0"); 
		// 设置标准 HTTP/1.0 no-cache header. 
		response.setHeader("Pragma", "no-cache"); 
		HttpServletRequest request = ServletActionContext.getRequest();

 这样,页面中的登录什么的在一定时间后会过期,在页面中加载的action也可以重新调用了,尤其是ajax调用action想要取得返回值时最为有用,如果不添加这句话,刷新页面之前,只能调用一次,注意,这几句话加载ajax调用的action中才有效

你可能感兴趣的:(Ajax,IE,扩展,action)