• Post Reply Bookmark Topic Watch Topic
  • New Topic

About session  RSS feed

 
LaraCroft
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
After I use getAttribute how can I yake what is in session nad write it froexaple like String.Do I neeed cast Objects
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"LaraCroft"
Obviously ficticious names are not allowed.
Please read the naming policy described at http://www.javaranch.com/name.jsp and change your display name accordingly.
Accounts that don't follow the naming policy get deleted.
Dave.
 
Shubhrajit Chatterjee
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep ...
Originally posted by LaraCroft:
Hello
After I use getAttribute how can I yake what is in session nad write it froexaple like String.Do I neeed cast Objects
 
inam paki
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
U better call the getClass() method on those objects in your session. It will return you the
Class type Object now call the getName() method on it.
This will return You the name of the class Your object belongs to in String. like:
Object obj = session.getAttribute("key");
Class c = obj.getClass();
String className = c.getName();
now you can check this String for any decision.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!