Hello,

Your suggestion is duly noted, and would probably be good
advice for many web apps. But keeping form beans in session
scope can be very handy at times, as has been pointed out in
other posts. Sessions are one of the main advantages of
servlets, after all.

So, you concede that using form beans the way they are
commonly used, in session scope with setters and getters
unsynchronized, is not thread-safe? 

Would you also agree that every call to
session.setAttribute() and session.getAttribute() needs to
be synchronized? 

Noah


On Wed, Jun 12, 2002 at 11:17:03PM -0700, Craig R. McClanahan wrote:
> 
> 
> The simplest way to avoid this whole set of problems is to use request
> scope for your form beans.  Then, the container guarantees that only one
> thread can access these beans, so you don't need to be concerned at all
> about thread safety in them.
> 
> Following this advice will also be beneficial, in general, to the
> scalability of your application -- because the server will not need to
> store the form beans in memory "in between" requests.
> 
> Craig

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to