Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to retrieve a session Bean in the Context in a class with the Context reference

Reply
Thread Tools

How to retrieve a session Bean in the Context in a class with the Context reference

 
 
asd
Guest
Posts: n/a
 
      11-09-2006
Hello this is my problem
in my servlet I set a new session attribute
request.getSession().setAttribute("AAA", new Aaa() );

now I've a Xxx class that has access to the Application Context. In my
Xxx class so I've a
private ServletContext context;

My Xxx class takes in input a String. this string is the sessionId.

Now my question is: with a sessionId string and the attribute name
("AAA") can i retrieve in my Xxx class the bean stored by the
request.getSession().setAttribute(..) in the appContext??

thanks a lot
martina

 
Reply With Quote
 
 
 
 
www.pulpjava.com
Guest
Posts: n/a
 
      11-09-2006
If you're asking if you can get access to data stored in another users
session, the answer is no.

The Session is mapped to a single user, and a single user only.

The ServletContext is global, and can be accessed by any user accessing
your web appliation.

Cheers!

-Cameron McKenzie www.pulpjava.com

Free SCJA Certification Questions: www.scja.com
Free J2EE and WebSphere Tutorials: www.mcnz.com
Free Mock WebSphere Certification Exams: www.examscam.com




asd wrote:
> Hello this is my problem
> in my servlet I set a new session attribute
> request.getSession().setAttribute("AAA", new Aaa() );
>
> now I've a Xxx class that has access to the Application Context. In my
> Xxx class so I've a
> private ServletContext context;
>
> My Xxx class takes in input a String. this string is the sessionId.
>
> Now my question is: with a sessionId string and the attribute name
> ("AAA") can i retrieve in my Xxx class the bean stored by the
> request.getSession().setAttribute(..) in the appContext??
>
> thanks a lot
> martina


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Saving request scope bean reference to session scone bean gallas.robert@gmail.com Java 1 03-19-2008 01:09 PM
Modelling an object as Session Bean or Entity Bean ? Francesco Java 3 12-07-2006 04:22 PM
EJB Transaction (Session Bean - Entitiy Bean) X3 Java 0 10-01-2004 07:41 AM
can a session bean return a local entity bean object? David Thielen Java 2 09-12-2003 07:45 AM



Advertisments