• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session Attributes

 
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I'm trying to store an ArrayList object in HttpSession, serializing the objects it contains. But, I'm unable to find that attribute in session, next time I retrieve it.
This doesn't work even if I stored a plain String object in session.

I was however able to store and retrieve the same objects from ServletContext.

Why could this be happening.

thanks
Allen
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not clear with your question. you put object into session with some key(attribute name) and get back the object using that key...
 
Ranch Hand
Posts: 375
1
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Allen Bandela wrote:Hello

I'm trying to store an ArrayList object in HttpSession, serializing the objects it contains. But, I'm unable to find that attribute in session, next time I retrieve it.
This doesn't work even if I stored a plain String object in session.

I was however able to store and retrieve the same objects from ServletContext.

Why could this be happening.

thanks
Allen



I think you need: - request.getSession(false) to get the existing Session. And then you can fetch the attribute set.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you put the objects in the session (and what's up with the serialization? :confused: ) and how are you retrieving them? Keeping us guessing isn't going to get you much concrete help.
 
Allen Bandela
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I know I'm not removing it from session anywhere else in the application.
The attribute is being found in ServletContext but not in Session.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you aren't removing that attribute from the session, but the next time you look at the session it isn't there, then a reasonable conclusion would be that there are two different sessions involved.
 
reply
    Bookmark Topic Watch Topic
  • New Topic