I cannot access my session object, it does exist though?????
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Joost_Schouten
Posted On:   Tuesday, November 19, 2002 06:04 PM

Hi, My session is instanciated in my controller servlet, and several beans are bound to it. My timout is succesfully set to 10 minutes (tested with the HttpSessionBindingListener which is implemented in one of the beans I bind to it). When I call RequestDispatcher.forward(request, response), the JSP I forward to reads out the session without problems. However, if I link to a JSP (your usual or a frame src property), the JSP's create a new session when request.getSession() is called, and the session created in my controller is left undone. Still exsists, but not retreived. What's happening????? I have spent about three days now trying to find what I'm doing wrong, without any luck. Does anyone have any idea where th   More>>

Hi,


My session is instanciated in my controller servlet, and several beans are bound to it. My timout is succesfully set to 10 minutes (tested with the HttpSessionBindingListener which is implemented in one of the beans I bind to it). When I call RequestDispatcher.forward(request, response), the JSP I forward to reads out the session without problems. However, if I link to a JSP (your usual or a frame src property), the JSP's create a new session when request.getSession() is called, and the session created in my controller is left undone. Still exsists, but not retreived. What's happening?????

I have spent about three days now trying to find what I'm doing wrong, without any luck. Does anyone have any idea where the problem might be. Can the JSP not retreive the session cookie? Is it a Tomcat 4 bug?


All tips are welcome since I'm starting to become desperate.


Thanks for your help

Joost Schouten

   <<Less

Are cookies turned on in browser?

Posted By:   Roger_Hand  
Posted On:   Tuesday, November 19, 2002 09:45 PM

By default session tracking uses cookies to maintain session across multiple queries from a browser. If the browser has cookies disabled then this system won't work, and you'll have to use urlEncoding for each one of your links, which means the container adds the session id as a query parameter to each link sent to the browser. The code, in the jsp page, looks like this:
">next

Needless to say, it's kind of a drag to have to wrap all your urls like that.


To help troubleshoot this problem I highly recommend getting HttpWatch, which will show you all the cookies and headers etc., that your browser gets and sends. It's $45 but well worth it [disclaimer: I am nothing more than a satisfied customer]. When the session is successfully using cookies you'll see the session id cookie show up. Good luck!

About | Sitemap | Contact