Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Are session attributes References to the real object?  RSS feed

 
Paul Duer
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI guys,
This is a pretty easy one, but I forget. Okay I have a set of servlets and pages, using struts in this case. On the first servlet, I load an object from a db and then I put that object on a session attribute.
Now when I call that attribute from the next servlet, I have the exact object from the first. If make changes in the second servlet to the object, do I need to do setAttribute again? Or does the Session just keep a reference to that object, so as it changes I will always get the latest changes because I made them to the same object?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct, the object is not cloned or anything like that. There is no need to 'reset' the object into the session.
hth,
bear
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!