This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Primitives in Session

 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Can we store any primitive type variable (for eg - float,char,int ) in Session scope ?
Waiting for a reply
Thanks
 
Patil Niteen
Ranch Hand
Posts: 48
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Abhay,

HttpSession interface has methods to store and retreive the objects from session scope.The methods are:
setAttribute(String name, Object value)
Object getAttribute(String name)

If you want to store the premitives in the session scope you have to wrap them into corresponding object types and retreive the values by casting the return values.
For example, int values can be wrapped into Integer object and stored .

Hope this helps.

Thanks and Regards,
Nitin.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic