Can we retrieve a session corresponding to a particular session ID?
I am getting session ID using
session.getId();
I want to retrieve the session corresponding to this ID.
Can we retrieve a session corresponding to a particular session ID?
I am getting session ID using
session.getId();
I want to retrieve the session corresponding to this ID.
You would need to implement a SessionListener and store a map of the sessions sessionId->HttpSession.
Here is a code example of a SessionLisetener: http://www.java2s.com/Code/Java/Servlets/Servletsessionlistener.htm
JSP provides couple of implicit objects and you can access without any additional effort: http://docs.oracle.com/javaee/5/tutorial/doc/bnahq.html#bnaij So, if you want to access to your current session just use the following code:
session.getAttribute("name");
session.setAttribute("name", "value");