近日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>
分享到:
相关推荐
Struts2 tiles操作例子,附带demo代码
struts中tiles标签简介,Tiles框架可以令我们组合可以复用的Tiles来搭建网页。
struts-tiles.tld
用于struts技术开发应用的架包 struts-tiles.1.3.10.jar
struts-tiles-el.tld
struts中web网页布局框架struts-tiles,简单配置就可。
这个用途不大,送大家了........我不怎么喜欢
使用struts的Tiles插件功能 使用拉Tiles框架 进行struts页面结构调整
struts2 tiles2配置的例子
struts2.0 整合tiles 配置
一个简单的应用Struts中tiles的例子
Struts-2.1.6整合Tiles2全攻略
关于struts-tiles的例子,基础,简单,实用。
模板搭建源码可运行
做了一个struts2 tiles的实例,仿照网上的一个例子,调通过了,jar包完整,在eclipse下运行,如果要在myeclipse下运行,请更改相应组织结构
页面布局struts tiles,方便用户方便快速的进行页面布局
struts2 tiles的使用(小实例)
体验Struts2和tiles的神奇结合。