| Author |
each time iam creating a new session
|
shekar krishna
Greenhorn
Joined: Jan 08, 2006
Posts: 4
|
|
Hi ppl, I want to reuse the existing session. I am saying req.getsession()in my code. But each time, it is creating a new one. How to reuse the existing session. I tried req.getsession() but it is not working fine. plz suggest. Thanks, chandra
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Originally posted by shekar krishna: I want to reuse the existing session. I am saying req.getsession()in my code. But each time, it is creating a new one. How to reuse the existing session.
How do you know that??
|
 |
Vishnu Prakash
Ranch Hand
Joined: Nov 15, 2004
Posts: 1026
|
|
|
Sessions are maintained by container. They are resued by default. Unless and untill that particular session is closed abruptly by closing the browser instance(or)server crash, user is in the same session.
|
Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
|
 |
shekar krishna
Greenhorn
Joined: Jan 08, 2006
Posts: 4
|
|
Hi Adeel, I came to know by printing the session object. It prints something like weblogic.blah.blah.blah@somenumber. It prints differnt number if u refresh the browser. Plz suggest. Thanks, Chandra
|
 |
Manoj Kumkumath
Ranch Hand
Joined: Dec 01, 2005
Posts: 71
|
|
You can try getting the Session by method request.getSession(false). This will return you a session only if there is an existing session and null if not.
|
<a href="http://www.goodoldmanoj.blogspot.com/" target="_blank" rel="nofollow">http://www.goodoldmanoj.blogspot.com/</a>
|
 |
Thibault Dangr�aux
Greenhorn
Joined: Dec 12, 2005
Posts: 19
|
|
|
When you test that, do you have cookies enabled? If cookies are not enabled, the server will not be able to track session accross pages, unless you take special steps (URL rewriting et response.encodeUrl).
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Originally posted by Thibault Dangr�aux: When you test that, do you have cookies enabled?
Check this out, Shekar.
|
 |
Jaime M. Tovar
Ranch Hand
Joined: Mar 28, 2005
Posts: 133
|
|
|
Is it a servlet or a jsp the one giving you troubles?
|
She will remember your heart when men are fairy tales in books written by rabbits.<br /> As long as there is duct tape... there is also hope.
|
 |
 |
|
|
subject: each time iam creating a new session
|
|
|