简体   繁体   English

java / jsf重定向页面

[英]java/jsf redirect page

when i opend my login page and i have connected with my email and password and when i diconnected page i am going to login page its gud upto here and when i press back button in the browser i am going to main page again. 当我打开登录页面并连接了我的电子邮件和密码时,当我断开连接页面时,我将登录到此处的页面,当我在浏览器中按返回按钮时,我将再次进入主页。

I have deleted sessions by using session.invalidate(),but iam not able to rediect the page to login. 我已经通过使用session.invalidate()删除了会话,但是我无法重新分割页面进行登录。

It is because your page is cached. 这是因为您的页面已缓存。

Create a filter that will set following headers to the response 创建一个过滤器,该过滤器将为响应设置以下标头

HttpServletResponse hsr = (HttpServletResponse) response;
hsr.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
hsr.setHeader("Pragma", "no-cache"); // HTTP 1.0.
hsr.setDateHeader("Expires", 0); // Proxies.
chain.doFilter(request, response);

Back Button brings HTML pages from browser cache. 后退按钮可从浏览器缓存中获取HTML页面。 You do not have a control over it. 您无法控制它。 But make sure that your authentication management does not let use the functionality that requires authenticated user. 但是请确保您的身份验证管理不允许使用需要身份验证的用户的功能。

You may, however set "no-cache" is header. 您可以,但是将“ no-cache”设置为标头。 But, I strongly discourage it. 但是,我强烈不鼓励这样做。 see how: 怎么看:

response.setHeader("Cache-Control","no-cache");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM