如何在jsp页面内停用缓存 [英] Howto deactivate caching inside a jsp page

查看:139
本文介绍了如何在jsp页面内停用缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有一个HTTP响应头指令来禁用页面缓存:

I understand there is a HTTP response header directive to disable page caching:

Cache-Control:no-cache

我可以通过手修改标题:

I can modify the header by "hand":

 <%response.addHeader("Cache-Control","no-cache");%>

但是有一种很好的方法可以让JSP解释器在服务器响应中返回这个标题行?

But is there a "nice" way to make the JSP interpreter return this header line in the server response?

(我检查了<%@ page ...%>指令。似乎没有那样的。)

(I checked the <%@page ...%> directive. It seems there is nothing like that.)

推荐答案

同时添加


response.addHeader("Expires","-1");
response.addHeader("Pragma","no-cache");

到你的标题并给它一个镜头。

to your headers and give that a shot.

这篇关于如何在jsp页面内停用缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆