| Author |
sessions
|
Nick Delauney
Ranch Hand
Joined: Sep 28, 2002
Posts: 43
|
|
Hello everyone, I have some code I was working on for friend. For some reason the session objects work on my machine but not on his. Can anyone tell me why this could happen? Do you have to declare a session object before you use it ? or is it automatic ? Thanks,
|
N.D:"Anything worth having, takes time to get"
|
 |
Nicholas Turner
Ranch Hand
Joined: May 24, 2003
Posts: 119
|
|
|
specify the scope at the top of the page
|
 |
Jason Taylor
Greenhorn
Joined: May 25, 2003
Posts: 4
|
|
|
You must explicitly define a session object, another thing if you are using jsp and you want to retrieve the object you placed in the session you must typecast the object,that was placed in the session, back to what it originally was.
|
Jason W Taylor
|
 |
Andy Bowes
Ranch Hand
Joined: Jan 14, 2003
Posts: 171
|
|
Sessions are automatically created by the WebServer, you don't need to explicitly create one. (Which WebServer are you using ?) If you are having problems with sessions it could be that a new session is being created for each Http Request. You can check this by retreiving the id of the current session from the request: request.getSession().getId(); If everything is working correctly, the same Session Id should be be returned for each request from a specific client (until they shut their browser). If not then it would appear that a different session is being created for each request. This could be due to a number of issues e.g. the original session could have timed out due to having too small a session lifetime configured on the server or the web container cannot locate the session id from the incoming request (This is typically stored in a cookie or request parameter with a name of jsessionid). I suggest that you do a bit of detective work and see if you can read the session id from the incoming request. HTH
|
Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
|
 |
 |
|
|
subject: sessions
|
|
|