这个问题在这里已经有了答案:
避免JSF Web应用程序上的回退按钮 2个答案为了处理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甚至会话过期也未被清除。 有什么办法可以解决这个问题吗?
This question already has an answer here:
Avoid back button on JSF web application 2 answersTo 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>in web.xml.
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的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.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 [重复](viewExpiredException JSF [duplicate])这个问题在这里已经有了答案:
避免JSF Web应用程序上的回退按钮 2个答案为了处理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甚至会话过期也未被清除。 有什么办法可以解决这个问题吗?
This question already has an answer here:
Avoid back button on JSF web application 2 answersTo 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>in web.xml.
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的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.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.
发布评论