Invalidating session in spring

Rated 3.94/5 based on 762 customer reviews

You have to somehow store what the current valid ID will be.For us, when the user logs in if no active session exists then that session becomes the valid ID.What I need to do is My jsp page should check if the current session is still valid & if it is then invalidate the session & redirect to another page outside the application. Please let me know how to check, if the sesion is valid & invaidate it if it is valid. As per my knowledge in a jsp page session object can never be null, because if you look at the _jsp Service method of servlet(jsp compiled servlet) the following line of code gets executed session = page Session(); means your session object is not null.Thanks in advance, Shalaka Check whether session object is null or not. So as per me one solution to your scenario code be put some value in session object in some page for e.g.You can connect to the system twice from the same machine using the same credentials and you'll create two sessions.(If you try to login in the same browser but two tabs, since in most browsers they share the same cookie set, your session will be the same for all tabs in the same browser instance.) So for this to work you need to somehow specify what the return value of "get Current Session(user Id)" returns.The only thing the new/valid session is doing is communicating to all other sessions that it is the only one allowed to continue.

Previously, we showed you how to use Spring Boot, MVC, and Mongo DB also Spring Boot, Mongo DB RESTful web service.

So when the filter executes for Person A it notices that the session IDs don't match and the assumption is that means the session with the different ID is invalid and their session should terminate.

So, Person A's request causes their session to have "session.invalidate()" called, thus ending their session.

So as per me one solution to your scenario code be put some value in session object in some page for e.g.

programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums Hi there, I wanted to invalidate a session by using sessionid.

Leave a Reply