Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session casting problem....

 
mike vas
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have the following code:

User user = new User();
user = (User)session.getAttribute("user");

Can anyone tell me how I can 'copy' the session object to 'user' so I can change the values of 'user' without changing the values of the object in the session..?
In the code above when I change a value in 'user' this is reflected to the session object.

thanks in advance.....

mike
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since copying/cloning objects is not a servlet specific issue..
Moving to Java In General (Intermediate).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic