How to maintain the same session id across multiple web applications in Java
如何在Jboss服务器中为多个Web应用程序维护相同的会话ID?
Take a look at this post, for similar question. Access session of another web application
What this is saying is
"Not directly. Most containers put each WAR in a separate classloader with the EAR classloader as their parent. Each app's sessions are separate. You can put something provided by the parent EAR in each session. If you need them to share something, make it a EAR function."
So, due to the each session being private, one web-app cannot see the other. So, your option is to bundle the two web apps in a single WAR file, to make them be able to share session data.
I was looking for this recently and found a solution.
If you just want to share the ID, you can use the following configuration in web.xml. Given that you use servlet 3.0.
<session-config>
<cookie-config>
<path>/</path>
</cookie-config>
</session-config>
This will save the jsessionid cookie with path "/" making it shared among all webapps. This is how JBoss 4 used to do it.
链接地址: http://www.djcxy.com/p/6276.html上一篇: 机器学习算法