Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Sharing session state between Servlet applications/contexts

Hi -

I am pretty new to all this Java stuff, and I have to find out why the session
of a web application defined in a <context> section of server.xml is not
acessible in a web application defined in a different <context> section.
By "not acessible", I mean that you get null when you do request.getSession(false)
after having previously run a servlet in the same browser.

Can anybody explain how session() works in this context?

Thanks,

--
Mark Alexander Bertenshaw
Programmer/Analyst
Chordiant Software, Inc.
Brentford
UK
[606 byte] By [Mark Alexander Bertenshaw] at [2007-11-9 22:31:34]
# 1 Re: Sharing session state between Servlet applications/contexts
Mark,
What web/app server are you using? Typically a servlet in one web app
(and its sessions) are not available to another webapp. This may be different
depending on web/app server and maybe configurable too. I've not personally
done alot with session variables. We keep state differently because we mainly
use applets or applications as our frontends. If you want the soapbox reason
let me know.

Mark

BTW, one does't run a servlet in a browser.
"Mark Alexander Bertenshaw" <mark.bertenshaw@virgin.net> wrote:
>
>Hi -
>
>I am pretty new to all this Java stuff, and I have to find out why the session
>of a web application defined in a <context> section of server.xml is not
>acessible in a web application defined in a different <context> section.
> By "not acessible", I mean that you get null when you do request.getSession(false)
>after having previously run a servlet in the same browser.
>
>Can anybody explain how session() works in this context?
>
>Thanks,
>
>--
>Mark Alexander Bertenshaw
>Programmer/Analyst
>Chordiant Software, Inc.
>Brentford
>UK
MarkN at 2007-11-11 23:02:36 >