`
cuishen
  • 浏览: 293669 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

struts1的tiles导致的response cache无法禁止的issue

    博客分类:
  • j2ee
阅读更多
近日struts 1项目中遇到一个很怪异的问题,项目中的所有.do都是继承自同一个root tiles,根JSP里面有把cache禁掉:
response.setHeader("Cache-Control", "no-cache, must-revalidate, proxy-revalidate, no-store");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "0");
response.setDateHeader("Expires", 0L);

但是在firebug里面看http response,大部分.do的response都没有cache,但是有个别.do的response cache依旧存在。。。

真见鬼了。。。

后仔细比对struts-config,发现那两个特殊的.do,都是在tiles里面forward到了其他.do:
<action path="/Index" type="com.cuishen.HomeAction">
	<forward name="success" path="success.home"/>
</action>

<definition name="success.home" path="/user/info.do" />

上例中"/Index.do"和"/user/info.do"都是继承的相同的根JSP,但是访问"/Index.do"页面会被缓存,直接访问"/user/info.do"则不会!

后将"/Index.do"中的tiles移除,直接forward到"/user/info.do",后问题解决(如下代码)! (我擦,一般人还真想不到!!)
<action path="/Index" type="com.cuishen.HomeAction">
	<forward name="success" path="/user/info.do"/>
</action>


0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics