viewExpiredException JSF [英] viewExpiredException JSF
问题描述
为了处理JSF中的viewExpiredException,我编码了
To handle viewExpiredException in JSF, I coded
<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即使会话过期也没有被清除。有没有办法解决这个问题?
In error.html
I have redirected to original login page. But the problem is session scoped bean were not cleared out even session expired. Is there any way to solve this?
推荐答案
可能是从浏览器缓存中请求了登录页面。通过创建一个绑定到 FacesServlet
的过滤器
来禁用它,并且<$ c $中基本上有以下几行c> doFilter()方法,这样您就不需要在要阻止缓存的所有页面上重复它。
The login page is likely been requested from the browser cache. Disable it by creating a Filter
which is tied to the FacesServlet
and has basically the following lines in the doFilter()
method, so that you don't need to repeat it over all pages which you'd like to prevent from being cached.
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.
这篇关于viewExpiredException JSF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!