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 casting problem.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
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).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session casting problem....
 
Similar Threads
How to put all user info into session?
ActionContext and Session Objects
session casting problem....
Saving session information on session timeout
How can a bean to get a object in application scope