aspose file tools*
The moose likes Java in General and the fly likes session casting problem.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "session casting problem...." Watch "session casting problem...." New topic
Author

session casting problem....

mike vas
Greenhorn

Joined: Dec 19, 2006
Posts: 5
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

Joined: Dec 11, 2004
Posts: 13410

See:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#clone()


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Since copying/cloning objects is not a servlet specific issue..
Moving to Java In General (Intermediate).
 
jQuery in Action, 2nd edition
 
subject: session casting problem....