weixin_33691700 2014-06-28 11:37 采纳率: 0%
浏览 24


Please consider below sample with struts 2 jquery plugin, ( but this could be happen with jquery)

In struts 2 jquery plugin set head tag to cache ajax calls:


The html head is ( do not cache any thing):

<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Pragma" content="No-cache" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Expires" content="0" />

There is also an interceptor which set resonse header as below:

    response.setHeader("Pragma", "No-cache");
            "no-cache, no-store, must-revalidate");
    response.setDateHeader("Expires", 0);

Consider a sample test.jsp file with single js in it

<script type="text/javascript" src="js/grid.js"></script>

The first time the test.jsp is loaded the grid.js is loaded and cached by browser, changing the grid.js will not cause the browser to get updated grid.js file any more !!

Of course I can fix this issue by setting ajaxcache="false"

My question is, if the grid.js is loaded only once and the client do not get newly updated js anymore, then what is the use of ajax caching ?!

Can you suggest a real case which you do not need to update any resource on the client, so client can catch a resource for a long time?!

Or we can use ajax caching in other ways ?!

  • 写回答

0条回答 默认 最新



    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
    • ¥15 onvif+openssl,vs2022编译openssl64