I am trying to send List of Items to JSP by setting them in a session. I am using Spring controller here.
List- l = new ArrayList
- ();
Java uses reference assignment. In your case when you assigns a list object to session attribute, session does not store a copy of that list object, instead it just stores the reference of the list object.
So any modification in that list object will reflect to session as well. If you don't want to update session, create a new list out of the existing list like below:
List list=new ArrayList(l);