You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Lars Preben S. Arnesen" <l....@usit.uio.no> on 2003/01/07 20:53:41 UTC

Sharing data between servlets

I have a few servlets that needs to share some data. For initial
testing I used the Resin servlet engine, but now I'm switching to
Tomcat.

When running the servlets on Resin, I fetched a pointer to the "root
context" like this:

ServletContext context = getServletContext().getContext("/");

When using Tomcat, the context pointer always is set to null.

So, is this the "correct" way to share data between servlets, or is
there a more elegant way that works on different servlet engines.

Code snippets to illustrate how the best way to share data between
servlets are appreciated. :)

-- 
Lars Preben

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>