• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving JavaBeans  RSS feed

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

got a little stuck here and can;t find anything with useful information on this.

All I need to do is retrieve a JavaBean held in session from a Servlet.

Any help would be greatly appreciated.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by A Sek:

... can;t find anything with useful information on this.

Where did you look?


java.lang.String)" target="_blank" rel="nofollow">http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSession.html#getAttribute(java.lang.String)
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not there, doesn't do anything
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by A Sek:
Not there, doesn't do anything


A Sek,

In order to help you get the most out of Javaranch, we've compiled a list of tips for posting here.
One in particular that will help you is:
http://faq.javaranch.com/view?TellTheDetails

Please read that entry and see if you can put your question together in a way that will make it easy for others to help you. I'm sure that once you do, plenty of people will be happy to give you a hand.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are unable to retrieve a reference placed in a session, the following are possible causes:
1. Spelling error in the name of the attribute
2. You actually have a new session, not the one you expect
3. Some other code removed it
4. The code that was supposed to add it didnt execute as expected.

If this was my problem I would use getAttributeNames() to see what the actual names are, and getId() to see if the session has changed.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!