Attribute being set unknowingly
Hi i am working on a site that generates reports. Some users [Admins] have capability of 'modifying' the report request submitted by other users. When the Admin clicks the 'modify' button i am setting some attributes.
these two are of importance in regards to my Q:
userSession.setAttribute("selectedPros", selectedPros);//where selectedPros is a list
userSession.setAttribute("initialRequestedPros", selectedPros);
all i am doing is trying to save the Pros requested by a NON admin user into initialRequestedPros. I am doing this so if the Admin tries to modfy the initial # of selectedPros he gets like a warning message.
So the problem i am having is that when some changes are being made to selectedPros list. This changes are affecting the initialRequestedPros attribute as well. so when finally the Admin clicks SUBMIT after modifying. I have no way of telling whether he made changes to the initial request submitted by the user. I cant understand as to WHY the same changes are reflecting on initialRequestedPros. Attribute :(
Thanks
Message was edited by:
bhaarat_java
This will clear some confusions to you guys:
So the code is this:
List selectedPros = (List) userSession.getAttribute("selectedPros");
System.out.println("This is initialRequestedPros in buildSelected 0" + userSession.getAttribute("initialRequestedPros") );
selectedPros.clear();
System.out.println("This is initialRequestedPros in buildSelected 1" + userSession.getAttribute("initialRequestedPros ") );
/*This is the output i got*/
[11/26/06 12:42:13:415 EST] 1817cf0a SystemOutO This is initialRequestedPros in buildSelected 0[100001 Bhaarat Sharma]
[11/26/06 12:42:13:415 EST] 1817cf0a SystemOutO This is initialReqProvider in buildSelected 1[]
[11/26/06 12:42:13:415 EST] 1817cf0a SystemOutO This is initialReqProvider in buildSelected 2[052803 Some other Name]
This is really really weird to me

