| Author |
Primitives in Session
|
Abhay Agarwal
Ranch Hand
Joined: Feb 29, 2008
Posts: 697
|
|
Hi
Can we store any primitive type variable (for eg - float,char,int ) in Session scope ?
Waiting for a reply
Thanks
|
Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
|
 |
Patil Niteen
Ranch Hand
Joined: Dec 10, 2009
Posts: 48
|
|
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.
|
SCJP 1.4, SCWCD 5
|
 |
 |
|
|
subject: Primitives in Session
|
|
|