KAUSTUBH_NADGIR wrote:

> In our application, we have around 3-4 servlets based upon the broad
> functionalities of the system.
> What we want to know is that how do we share common information between
> these servlets. Can we have something global across servlets. Or can we
> access variables of one servlet in some other servlet.
> What is the usual way of doing this. Any pointers to some working examples
> on servlet designing etc. will also be appreciated.

Many ways of doing this...
Slightly depending of what you have and want to accomplish, I would suggest;

Create a singleton that is a ResourceManager. The servlets knows how to obtain
the singleton, typically SingletonClass.getInstance(), and can from there
access whatever you define.

What you must remember is that the resources themselves can not be part of the
servlet, because you will end up with ClassLoader problems, i.e "classes with
the same name loaded by different classloaders are not assign compatible". And
each servlet typically gets loaded by its own classloader, so that they can be
reloaded in runtime.

Niclas




------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Problems?:       [EMAIL PROTECTED]

Reply via email to