Thanks. I tried that first.
It looks like that the context changes after a while
or is different for 2 different servlets. That is why
I thought of using another class to make the servlets share data..



-----Original Message-----
From: Dan Mork [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 2:47 PM
To: [EMAIL PROTECTED]
Subject: Re: Interservlet Communication


Greetings,

>From j2ee documentation: "...servlets can share information using the
ServletContext class and can perform shared business logic by invoking
methods on common non-servlet classes."

The ServletContext interface exposes a void method
setAttribute(java.lang.String, java.lang.Object) that you can use to add an
Object to the ServletContext (and retrive it with the other Servlet using
getAttribute).

Hope this helps!

Cheers,
Daniel Mork


-----Original Message-----
From: Johri, Priyank [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 10:55 AM
To: [EMAIL PROTECTED]
Subject: Interservlet Communication


Folks,
This is my second post (didn't get answers to the first one!).
I want to know how to make servlets communicate with each other.
I specifically want to know how I can create a singleton object and access
it
from two different servlets. I tried doing this but it does not work.
It looks like that the servlets are being loaded by different classloaders
or in a different contexts, and the instance of the singleton is not the
same for both.
Any help is appreciated.

Priyank

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to