防止JSP缓存

时间:2013-03-06 07:37:27

标签: java jsp caching browser-cache http-caching

<%
    response.setHeader("Cache-Control","no-cache"); 
    response.setHeader("Pragma","no-cache"); 
    response.setDateHeader ("Expires", -1); 
%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.services.*" import="java.util.*"
    import="java.text.*"%>
<jsp:include page="top.jsp"></jsp:include>

<html>
    <head>
        <link href="login-box.css" rel="stylesheet" type="text/css" />
    </head>
    <body onload="getcontacts();deleteContact();">    
</html>

我正在尝试阻止我的Web应用程序缓存,我插入了以下代码:

<%
    response.setHeader("Cache-Control","no-cache"); 
    response.setHeader("Pragma","no-cache"); 
    response.setDateHeader("Expires", -1); 
%>

但是它仍在缓存,当我退出并且我按回来时它仍然会回到最后一个会话。任何hlep plz。我应该插入别的吗?

0 个答案:

没有答案