首页 > 代码库 > OSCache报错error while trying to flush writer

OSCache报错error while trying to flush writer

Struts2.3+spring3+hibernate3开发
现在想在原有基础上使用 oscache提高性能,使用中发现问题
例如:使用struts2标签
<cache:cache time="60" scope="session">
<s:action  name="ztree.action" executeResult="false"/>
</cache:cache>
其中 这个action功能是从数据库读取数据 报错
WARN [http-8080-Processor5] ActionComponent:122 - Error while trying to flush writer
java.io.IOException: Illegal to flush within a custom tag
at javax.servlet.jsp.tagext.BodyContent.flush(BodyContent.java:79)
at com.opensymphony.webwork.components.ActionComponent.end(ActionComponent.java:120)
at com.opensymphony.webwork.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:21)
at org.apache.jsp.oscacheDemo_jsp._jspx_meth_ww_action_0(org.apache.jsp.oscacheDemo_jsp:232)
at org.apache.jsp.oscacheDemo_jsp._jspx_meth_cache_cache_0(org.apache.jsp.oscacheDemo_jsp:178)

但是数据一样能取出来
在一分钟内 刷新该页面 cache包含的部分不再执
其实设置下 参数 flush="false" 为false即可。

<cache:cache time="60" scope="session">
<s:action  name="ztree.action" executeResult="false" flush="false"/>
</cache:cache>

OSCache报错error while trying to flush writer