There's a number of solutions for your problem, but I think the simplest one
is using ServletContext as you've been sugested.

Actually JSP uses ServletContext to control application scope beans. So,
using ServletContext directly, kindof  give you more freedom to work.

The concept is simple: you have a pool where you put any instatiated objects
by associating them with a String name(like a Hashtable)  and all your web
clients will be able to retrieve this instance (by acessing your JSP and
Servlets pages, of course!)

With this in hand, you can construct either a system with threads to control
your pairs of users or even instantiate as much objects as needed and put
them directly into ServletContext.

Take a look at the ServletContext documentation, I think you'll find your
way there.

Good luck

Leandro

----- Original Message -----
From: "Michael Ni" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 17:38 PM
Subject: different clients using the same instance of a bean


> How do I have groups of different clients from different browsers use the
> same instance of a bean.  I'm not talking about application scope.
> Application scope is everyone using the same instance of a bean.  I'm
> talking about bob and joe using one instance of bean A and ken and barbie
> using another instance of bean B while all clients are using different
> computers.
>
> Someone suggested servletcontext to me but I think that refers to
> application scope.  I was looking into session id but its depreciated in
the
> new java formats.  I dont understand how setAttribute and getAttribute
> works.  is anyone knowledgable in this subject and can direct me in the
> right direction?
>
> mike
>
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to