退出问题!
我有大约 30 个带有登录和注销的 jsp 页面。我已将所有页面放入会话中,以便只有有效的用户才能访问。现在的问题是,每当用户注销时,会话就会失效,但如果用户按下浏览器的后退按钮,它仍然会显示受保护的页面(不应显示)。
我了解到问题出在保存缓存和历史记录的浏览器上。因此,我在安全页面上应用了 response.setheader("cache-control",.....)
等,也在 window.history.go(+1)
中应用了受保护页面的正文。
它在某种程度上工作正常,但偶尔会显示受保护的页面。而且,一旦用户登录会话开始并且当他进入网站时,后退按钮应该可以毫无麻烦地为他工作(不会提示用户重新发送表单数据)。一旦他注销,会话就应该结束,并且他应该无法再通过点击后退按钮访问页面。有什么办法可以实现这一点吗?
I have some 30 jsp pages with login and logout. I have put all the pages in the Session, so that only valid user can have access. Now the problem is, whenever user hits the logout the session gets invalidated but if the user presses the back button of the browser still it displays the secured pages (which shouldn't get displayed).
I got to know that the problem was with the browser which holds the cache and history. So I applied response.setheader("cache-control",.....)
etc. on secured pages and also window.history.go(+1)
in the body of secured pages.
It works fine to some extent but once in a while it displays the secured pages. And also once the user logs in session starts and when he will be inside the website, back button should work for him without any hassle (without prompting the user to resend the form data). Once he logs out the session should end and he should not be able to access the pages anymore by hitting back button. Is there any way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1 为了检查用户是否经过身份验证,不要在 jsp 上使用代码,我们有
Filter
只使用它。2 设置您的
过滤器
< /a> 执行以下操作来解决缓存问题3 删除 javascript
1 For checking if the user is authenticated don't use code on jsp , We have
Filter
for that only make use of it.2 Make your
Filter
to do following to resolve caching issue3 Remove javascript