【问题标题】:Web application error when i try to clear the cache当我尝试清除缓存时出现 Web 应用程序错误
【发布时间】:2014-03-09 09:11:38
【问题描述】:

在我的网络应用程序中,我使用这些指令清除网页的缓存

<%
response.addHeader("Cache-Control", "no-cache,no-store,private,must-revalidate,max-stale=0,post-check=0,pre-check=0"); 
response.addHeader("Pragma", "no-cache"); 
response.addDateHeader ("Expires", 0);
%>

但是如果我按下浏览器的按钮(“返回”),它不会加载更多页面(网页已过期)。 我该如何解决?

【问题讨论】:

    标签: jsp jsf jakarta-ee servlets scriptlet


    【解决方案1】:

    如果您使用 JSF 1.2 或更高版本,您需要像这样进行更改:

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="cache-control" content="no-cache" />
        <meta http-equiv="pragma" content="no-cache" />
        <meta http-equiv="expires" content="0" />
    </h:head>
    

    它可以是 template.xhtml 的一部分

    【讨论】:

      猜你喜欢
      • 2023-02-03
      • 2020-09-25
      • 1970-01-01
      • 2015-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多