简体   繁体   English

将书签页面重定向到登录页面

[英]Redirect a bookmarked page to login page

I've a login page and some pages managed with session after login. 我有一个登录页面,有些页面在登录后通过会话进行管理。 If a user bookmarks a page after logging in, and tries to access the same bookmark later, I want that page to be redirected to login page again to enable secure access. 如果用户在登录后为页面添加了书签,并稍后尝试访问同一书签,我希望该页面再次重定向到登录页面以启用安全访问。 How can this be achieved with jsp. 如何使用jsp来实现。 Or is there some other way like javascript,etc., I would appreciate any help on this. 还是有其他类似javascript的方式,对此我将不胜感激。 Thanks in advance. 提前致谢。

IT's hard to say for sure without seeing any code. 没有看到任何代码,很难肯定地说。 Essentially what you need to do is check the users session to see if it is still valid and then do the redirect if it is not valid. 本质上,您需要做的是检查用户会话以查看其是否仍然有效,然后如果无效则执行重定向。

you can redirect in JavaScript via 您可以通过以下方式在JavaScript中进行重定向

window.location = "Redirect Url"

You say you are using JSP so check this question, it looks to be what you need to do. 您说您正在使用JSP,因此请检查此问题,它看起来像是您需要做的。

Checking if a user is already logged in or the session is started in jsp 检查用户是否已经登录或会话是否在jsp中启动

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

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