Re: Session based object, accessible to all classes.

2004-09-28 Thread werner
Hi,
Eh, store the object in the session with
session.setAttribute(name, object)
retrieve it with
(cast-to your object)session.getAttribute(name).
Or is this a too simple answer for your problem ?
Regards
Werner
On Sep 28, 2004, at 10:23 AM, Pawson, David wrote:
My tomcat 5.0.27 app currently generates session based data in
a number of classes.
  Is there a common way of sharing a data structure across
these classes?
 I want to instantiate it when a user logs in, add to it from
one class, then retrieve data from another class.
  This data will vary across users, hence is not common to
all sessions.
TIA,
Regards DaveP.
 snip here *

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


RE: Session based object, accessible to all classes.

2004-09-28 Thread Pawson, David
 

-Original Message-
From: werner 

Eh, store the object in the session with 
session.setAttribute(name, object) retrieve it with 
(cast-to your object)session.getAttribute(name).

Or is this a too simple answer for your problem ?

javax.servlet.http 
Interface HttpSession ? Is that the one you mean Werner?
Just give it any recognisable name and it returns the object
based on this users session?

Sounds about right, so long as it is session based,
which it seems to be from the javadocs.

Much appreciated.  

DaveP

** snip here **

-- 
DISCLAIMER:

NOTICE: The information contained in this email and any attachments is 
confidential and may be privileged.  If you are not the intended 
recipient you should not use, disclose, distribute or copy any of the 
content of it or of any attachment; you are requested to notify the 
sender immediately of your receipt of the email and then to delete it 
and any attachments from your system.

RNIB endeavours to ensure that emails and any attachments generated by
its staff are free from viruses or other contaminants.  However, it 
cannot accept any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email and 
any attachments are those of the author and do not necessarily represent
those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk




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



Re: Session based object, accessible to all classes.

2004-09-28 Thread QM
On Tue, Sep 28, 2004 at 12:28:11PM +0100, Pawson, David wrote:
: Interface HttpSession ? Is that the one you mean Werner?
: Just give it any recognisable name and it returns the object
: based on this users session?

Yes.  Think of session as another scope, like request or
application: it's a bucket in which you can store any old Object (just
be sure to cast it back to your expected object when you get it back).

Session scope is special because it is bound to, well, a session, which
should be a particular instance of a particular user account.  (i.e. if
bob logs in twice from different browsers, he will likely have two
different sessions.)

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



RE: Session based object, accessible to all classes.

2004-09-28 Thread Pawson, David
 

-Original Message-
From: QM

Yes.  Think of session as another scope, like request or
application: it's a bucket in which you can store any old 
Object (just be sure to cast it back to your expected 
object when you get it back).

Session scope is special because it is bound to, well, a 
session, which should be a particular instance of a 
particular user account.  (i.e. if bob logs in twice from 
different browsers, he will likely have two different sessions.)

-QM


Thanks. Appreciated.
Another step forwards.

regards DaveP

-- 
DISCLAIMER:

NOTICE: The information contained in this email and any attachments is 
confidential and may be privileged.  If you are not the intended 
recipient you should not use, disclose, distribute or copy any of the 
content of it or of any attachment; you are requested to notify the 
sender immediately of your receipt of the email and then to delete it 
and any attachments from your system.

RNIB endeavours to ensure that emails and any attachments generated by
its staff are free from viruses or other contaminants.  However, it 
cannot accept any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email and 
any attachments are those of the author and do not necessarily represent
those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk




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