| Author |
Modifying a Bean
|
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
If I have a bean in a session, and in a servlet I get an instance of that bean, modify the parameters, do I then need to add the bean back to the session or will the session object contain the new values? So for example MyBean bean = (MyBean)session.getAttribute("mybean"); bean.setA("A"); bean.setB("B"); Now, at this point, do I need to do: session.setAttribute("mybean", bean); or not... Thanks.
|
 |
Steve Leach
Ranch Hand
Joined: Sep 24, 2003
Posts: 46
|
|
|
You don't need to save the bean back. You are working with a reference to the original bean.
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
Great, thanks Steve.
|
 |
 |
|
|
subject: Modifying a Bean
|
|
|