Hi Huu, 

First of all the session is ALWAYS on application scope, this is not an
Tomcat specific behaviour but a requirement of the Specification:
"SRV.7.3 Session Scope
HttpSession objects must be scoped at the application (or servlet context)
level.
The underlying mechanism, such as the cookie used to establish the session,
can be
the same for different contexts, but the object referenced, including the
attributes in
that object, must never be shared between contexts by the container."

So there is no way around this, if the sessions were relicated across the
applications it would violate the specification.

When you enable crossConext for your application:
<Context crossContext="true" docBase="testapp" path="/testapp"
reloadable="true">
</Context>

you can get the context for another application:
ServletContext context2 = context.getContext("/testapp");

and set attributes:
context2.setAttribute("test","JSP is great!");

But you cannot get to the session in the other application.

So what you can do is implement the session swapping on your own (Cookies,
via the Database) or merge your applications into one.

Some links from the Sun Forums:
http://forum.java.sun.com/thread.jsp?forum=33&thread=259394
http://forum.java.sun.com/thread.jsp?forum=45&thread=492484
http://forum.java.sun.com/thread.jsp?forum=33&thread=318569

Cheers Bernhard

-----Urspr�ngliche Nachricht-----
Von: Kieu Huu Dung [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 13. Januar 2005 12:35
An: Tomcat Users List
Betreff: session across webapps


Hi all,

I prefer one (only one) session for all webapps
(Tomcat 5.0.28 and I've turned on SingleSignOn - user
login once for all webapps) or how can I know user is
in the same session between the login and logout when
he/she is in differents webapps.

Does anyone know is it possible or not? If possible
how can we do it? If not, is there another way to
share informations between webapps?

Thanks for your help,

Huu Dung Kieu.


                
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to