You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Ni <mi...@hotmail.com> on 2003/03/25 21:38:48 UTC
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: different clients using the same instance of a bean
Posted by Mark Pease <mp...@chartermi.net>.
How will your application know which bean to direct a certain user to?
Maybe if you give a little more insight into why you are trying to
accomplish this, someone will think of a solution.
For my application, I have an application-scope bean that acts as the
'manager' of a group of state beans, which are shared by different users.
It controls the life of them, along with access.
Mark
----- Original Message -----
From: "Michael Ni" <mi...@hotmail.com>
To: <to...@jakarta.apache.org>
Sent: Tuesday, March 25, 2003 3: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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: different clients using the same instance of a bean
Posted by "Leandro P. Martins Jr." <le...@kingnet.com.br>.
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" <mi...@hotmail.com>
To: <to...@jakarta.apache.org>
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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org