views:

78

answers:

3

Hi!

I am having problems in Java while managing sessions. All works perfect(I create and get/set values in the session), until I redirect with a link (the link is in a JSP). Then, the session is lost.

My server is Tomcat, and my browser is a Firefox browser. I am using Struts 2.

Thanks for your time ;-)

+1  A: 

If you accept cookies in your navigator, your code may call invalidate() when you go on this page. Check filters too.

Colin Hebert
+2  A: 

The standard time for the session to automatically get erased is about 30 minutes (for example in Tomcat), but it depends on the configuration.

If you write session.invalidate(), your session gets erased too.

Your session gets automatically lost if you close every tab in the browser you opened the session (even is you have other windows with the same browser).

Is your link inside the same application server? If it does, it shouldn't get lost if you are not doing things I said before.

greuze
Thanks, it was kinf of link problem ;-)
Raspayu
+1  A: 

One possibility is that your current session cookie is marked as "secure", and the 'href' is an "http:" link. This will cause the browser to not send the cookie, and depending on your webapp structure a new session may then be created automatically.

Stephen C
Yeah, that is what I thougt, but there my colleges are telling me that, using the <s:a> or <s:url> struts tag in the jsp it should not give problems. Is there any other reason possible?
Raspayu