Redirect user to another screen

112 Views Asked by At

I'm developing a website using javascript, jspx, and java (Spring using Mvc). I have an admin profile where I can shut down sessions from another logged users, my problem is that when I log out those users they stay in the page they were, and they are redirected to the log-in page when they click in another link, so, they are not aware that they were log out after they try to move to another page in the website. Is there a way that I can redirect them immediately after I shut them down?

PD: To shut their session down I'm using sessionRegistryImpl.

    sessionRegistryImpl.getSessionInformation("userId").expireNow();

Thank you!

1

There are 1 best solutions below

0
Jason Delaney On

You could try and use HttpServletRequest request and HttpServletResponse response, after you expire the session use the response method to redirect

response.sendRedirect(request.getContextPath() + "/login");