I am using websphere application server.
I have couple of web applications and i need to share my session accross them.
Please let me know how can i do it?
It depends on your version of WAS and also in your deployment policy (all web modules in a single enterprise application or in separate ones):
- If you're using WAS5 AND a single EAR you can share session attributes across all the Web modules, this can be configured in the Application Server Toolkit (ASTK), WebSphere Studio, or the Application Assembly Tool (AAT). This is a J2EE extension that allows for the session object to be shared across the multiple Servlet contexts inside a single enterprise application.
- If you're using WAS5 and multiple EARs you can use the WebSphere memory-to-memory session replication (for more details see the ibm redbooks).
- Else you can use the database session persistence, but this solution typically entails more expense and complexity and performance degradation...
Curiosity sake why you need to share the session?. As Nabil pointed out that websphere allows to do so but I think the other applicatiom servers won't allow this and you need to use database persistence.