会话超时后如何重定向到指定页面

发布于 2024-12-20 19:33:08 字数 119 浏览 1 评论 0原文

如何将用户重定向到他在会话超时之前已经打开的页面。

例如,用户打开/contactUs.jsp页面,然后会话超时并重定向到login.jsp页面,当他再次登录时如何将他重定向到contactUs.jsp页面?

How can I redirect the user to the page he has already opened before session time out.

For example the user was open /contactUs.jsp page, then the session time out and he redirects to the login.jsp page, how can I redirect him to contactUs.jsp page when he login again?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梦回旧景 2024-12-27 19:33:08

您可以编写一个 过滤器 并检查会话属性是否存在于会话对象中。您必须在用户登录成功时添加/设置会话属性。

You may write a filter and check whether a session attribute is exists in the session object. You have to add/set session attribute at the time when user logged successfully.

被你宠の有点坏 2024-12-27 19:33:08

您如何重定向到登录页面?此时,您应该将最初请求的 URL 存储在某处(可以在会话中,或者您传递的请求参数),以便在他再次登录后您可以重定向回那里

How are you redirecting to the login page? At that point you should store the originally requested URL somewhere (can be in session, or request param that you pass around) such that you can redirect back there after he logs in again

小瓶盖 2024-12-27 19:33:08

您必须使用登录 jsp 本身中的隐藏字段来完成此操作,因为服务器将无法识别用户,因为会话已经失效。

You'll have to do it using a hidden field in the login jsp itself, because the server won't recognize the user since the session has already been invalidated.

别再吹冷风 2024-12-27 19:33:08

您可以将 JavaScript 刷新片段放入带有会话超时的响应页面中。

您还可以使用“刷新”字段 HTTP 标头。

参考:http://en.wikipedia.org/wiki/List_of_HTTP_header_fields 并搜索“刷新”

You can put an JavaScript refresh snippet into the response page with the timeout of the session's.

You can also use "Refresh" field HTTP header.

Refer to:http://en.wikipedia.org/wiki/List_of_HTTP_header_fields and search for "Refresh"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文