are they in the same webapp?

your best best may be to create a singleton which acts as a datastore and
both the servlets can access

-rick

-----Original Message-----
From: Lars Preben S|rsdahl Arnesen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 2:54 PM
To: [EMAIL PROTECTED]
Subject: 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:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

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

Reply via email to