Invalidating a session using session 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. The first page is the Logon page where the user enters logon id and password which gets stored in session.Actually I want to redirect a user to the login page if the session is invalid either he presses back button or enters a url. The code for session invalidation is as under : Http Session ses = Session(); ses.invalidate(); after calling this servlet code my session gets ended and m redirected to login page.But as a press back button my previous page is displayed with "null" as my username. I want, when I press back button and as my session got ended simply my login page would be displayed. Dear raephel, You haven't mentioned that you are using Browser's back button Or your application having some back button. Right now let's assume that you are pressing your application's back button not browser's back button.
This sort of answer confuses me, because, ultimately, it seems, just about any question could be answered by pouring over the API and trying out various things.This prevents display of any page EXCEPT the one immediately following the login page (Welcome.jsp).If the user refreshes Welcome.jsp, IE resubmits the Logon Form containg the username and password, Logon Action accepts these values and 'presto' the user is in again.One of the reasons ..all, i want logout from one if i click browser back button,it bring me back to the jsp page...i do not want that..(i want like gmail.i.e, once you logout the page,then using browser back button you can not go back) please anyone give me the idea.. My problem is that when user closes the window directly(without logout), How to count active sessions.thanks & regards, seetharaman I am working on a web based application. It is happening that when somebody closes the application (without logout),the session counter will not decrement. Background Info: I am working on a project to lock a product id number so it may not be accessed by more than one session at a time.
I create a lock by writing the session id, product id number, user id and timestamp to a oracle database table.