File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Session Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Objects" Watch "Session Objects" New topic
Author

Session Objects

Mrigasira Srinivas
Greenhorn

Joined: Feb 28, 2001
Posts: 17
Hello All,
I am placing an object containing data retrieved in session for displaying it on multiple screens. When the user clicks on the save button, I need to update the session object (such that I can display the changed data if there is an error for the user), and also have the old object in order to make some comparisons. I have tried placing the same object in session with two different names, but that did not help. Can someone please let me know what I am doing wrong?
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
if you need to keep both of the objects in your session-set 2 different attributes with 2 different names.
if you have problems with your code - post it here.


Asher Tarnopolski
SCJP,SCWCD
Andy Bowes
Ranch Hand

Joined: Jan 14, 2003
Posts: 171
It sounds like you are adding 2 entries into your session which actually both reference the SAME java object, i.e. the changes made to the object will be displayed regardless of which key you use to retreive it from the session.
You will need to create a COPY of the original object, apply the changes to the copy and then add this copy into the session.


Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
Mrigasira Srinivas
Greenhorn

Joined: Feb 28, 2001
Posts: 17
Thanks Andy... That is what I was doing - putting the same object in session with different names. Copy seems to work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Objects
 
Similar Threads
Cookie or Session Object??
Complex types in a struts form
get the data after Session expired
Sending a bean to a struts jsp page
Design Issue(Urgent)