I am storing userid in session in my project, but it becomes somehow null. I want access the sam开发者_JAVA百科e session in a different JSP file with that session only. I want do some task such as auto refresh. How can I do it?
Either the user isn't there, or there's means of a different session. Print the following in the both JSP's
${pageContext.session.id}
and check if they are the same. If they are the same, then the user is simply not (correctly) been placed or accessed in the session in first place. If they are different, then the session has just been expired or invalidated, or there's means of a differnet context or even a different domain in URL. The session is namely bound to a specific domain and context. It's however possible to share the session among differnet contexts on the same domain, but how to configure that depends on the servletcontainer used.
精彩评论