开发者

Java: I lose the session: Would it be a problem from using "<a href >"?

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 ;-)


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜