how to manage sessions in JSP. I want to create a session as soon as user logs in and disable the session when he logs out. I also want to disable back button so that when he presses back button login page has to be opened.
Re: session management??
When a user open the broser and done some work or some change and then close the browser then
it will be stored in cookie and also called the session time in which user access the browser.You can get session ID in jsp by using session.getId() and can set the session user by using session.setAttribute("Session",setsession),
When user does their work complete and want to close browser,It is called expire or destroy the session.You can find the session starting and ending using session.getCreationTime() and session.getLastAccessedTime() respactively.
JSP Stores and Retrieves Session Variables as thje following:
<% @page import = "java.util.Date" session="true"%>
<p>JSP (java server page) are required following</p>
Session ID of user in JSP : <%session.getId()%><br>
Started time of session in JSP<%new Date(session.getCreationTime())%><br>
expiry time of session in JSP<%new Date(session.getLastAccessedTime())%>
|All times are GMT +5.5. The time now is 08:28.|