• Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaBean Thread Safety?

 
Andreas Sandberg
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I currently have an application I'm working on where users add work log entries through a standard form. They can add multiple entries and then click save which adds the entries to a database. While they are adding new entries they can view all their old entries and delete or update any of them. I'm currently storing all of these entries through a servlet in a vector and adding them to a particular user through the session API, but I'm wondering if I shouldn't do this through a bean method? I currently have a bean setup which validates all of the entries. If the validation is true I then pass the request to a servlet which stores the entries in a vector. Should I transfer this control to a bean? If I do, how can I ensure that each user logged into the system gets their own bean and that other users aren't accessing other peoples bean's? I set the scope of the bean to a session scope so I'd imagine that the bean will remain with that particular user but I just want to be on the safe side! Thanks so much.

Andreas
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, scoped variables stored in the session are not accessible by other users.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!