Hi,
My app. interacts with a payment gateway. I need to resume my older session once the transaction is over. Have achieved it by storing my session in a HashMap and putting the HashMap in application scope. Iam able to retrieve the same once the transaction is over.
But the problem is whenever I call
HtptpSession session = req.getsession();
it creates a new session for me.
Also similar problem in the jsps with <jsp:useBean> tag.
Any suggestions wud be appreciated.
Thanks.
Cheenu.
-
Retrieving session (4 messages)
- Posted by: Viswa Cheenu
- Posted on: March 13 2006 06:56 EST
Threaded Messages (4)
- Retrieving session by Srinath Anand on March 13 2006 12:56 EST
- Retrieving session by Rajagopalan Sreenivasan on March 14 2006 14:24 EST
- Restoring Session by Viswa Cheenu on March 15 2006 03:55 EST
- Restoring Session by Rajagopalan Sreenivasan on March 18 2006 11:42 EST
- Restoring Session by Viswa Cheenu on March 15 2006 03:55 EST
-
Retrieving session[ Go to top ]
- Posted by: Srinath Anand
- Posted on: March 13 2006 12:56 EST
- in response to Viswa Cheenu
Hi, My app. interacts with a payment gateway. I need to resume my older session once the transaction is over. Have achieved it by storing my session in a HashMap and putting the HashMap in application scope. Iam able to retrieve the same once the transaction is over. But the problem is whenever I call HtptpSession session = req.getsession();it creates a new session for me.Also similar problem in the jsps with <jsp:useBean> tag.Any suggestions wud be appreciated.Thanks.Cheenu.
Hi,
There is a isNew() method in HttpSession that can be used to check if the session is new or old. The API says: Returns true if the client does not yet know about the session or if the client chooses not to join the session.
Maybe you could use this method. AFAIK request.getSession() always returns a new session.
Hope this helps. -
Retrieving session[ Go to top ]
- Posted by: Rajagopalan Sreenivasan
- Posted on: March 14 2006 14:24 EST
- in response to Viswa Cheenu
Try using req.getSession(false);
This should return a pre-existing session.
Hope it helps,
Sreeni -
Restoring Session[ Go to top ]
- Posted by: Viswa Cheenu
- Posted on: March 15 2006 03:55 EST
- in response to Rajagopalan Sreenivasan
Try using req.getSession(false);
This doesn't work. I t just creates a new session. -
Restoring Session[ Go to top ]
- Posted by: Rajagopalan Sreenivasan
- Posted on: March 18 2006 23:42 EST
- in response to Viswa Cheenu
Request.getSession(boolean create) must create an existing session, if one exists and if it doesn't must return null..
Sreeni