为了在JSF中处理viewExpiredException,我编写了
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/error.html</location>
</error-page>
<session-config>
<session-timeout>1</session-timeout>
</session-config>在web.xml中。
在error.html中,我已重定向到原始登录页面。但问题是,即使会话过期,会话作用域的bean也没有被清除。有什么办法可以解决这个问题吗?
发布于 2010-01-22 08:35:41
登录页面很可能是从浏览器缓存中请求的。禁用它的方法是创建一个绑定到FacesServlet的Filter,它在doFilter()方法中基本上有以下几行,这样您就不需要在所有想要防止被缓存的页面上重复它。
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
response.setDateHeader("Expires", 0); // Proxies.https://stackoverflow.com/questions/2114010
复制相似问题