Java,Tomcat,Sessions - JSessionId disappears

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2010-04-01T21:06:40Z Indexed on 2010/04/01 22:13 UTC
Read the original article Hit count: 471

Filed under:
|
|

Hi,

I'm having a problem with java sessions.

I'm developing a simple web app, where I have to use sessions and session attributes. Everything is fine until I close my browser. When I close my browser the JSessionId disappears. Here's my code:

request.getSession().setMaxInactiveInterval(30*60); //it's 30 minutes
request.getSession().setAttribute("someinteger", 10);

It works great, but when I shut down the browser, and reopen it I can't find the jsessionId (before I closed the browser I could find it in the 'localhost' section). The strange thing is I can still find the "someinteger" cookie. What is the problem? What am I doing wrong?

I'm using this, too: link text, and it shows that JSESSIONID cookie expires : "SESSION", and "someinteger" expires in 30 minutes

Thanks in advance.

© Stack Overflow or respective owner

Related posts about java

Related posts about session