Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: JSP Servlet
Can some one please explain it with an example
Posted 4-Jun-13 21:57pm
Comments
Shubhashish_Mandal at 5-Jun-13 3:33am
   
Session use key-value pair to store data. You can store object in session and can retrieve it and can modify it against the key. But keep in mind , try to avoid to use session to store huge data.
Shruthi GM at 5-Jun-13 5:54am
   
Thanks Shubhashish. Can u please give me an example for this. I just want to store user information like(name, age, Dob, etc)in session and display it on jsp and again update the informations in same session
Shubhashish_Mandal at 5-Jun-13 7:12am
   
its very easy and I believe you can do this. Instead of putting all the information(name, age dob) separately in session, create an instance of type "User"(with name, age, dob properties) and set it in the session with a key.
To modify it simply retrieve it from session , then modify it and again set it in the session with the same key.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 5 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100