>Also, how do we deal with the situation where we need to build up >information over a series of requests before we can actually save it or do >something with it (ie: wizards etc...)
In reply to an earlier post regarding something similar, my idea is to encapsulate the information required for the wizard in a DVO and not a form bean. This helps keep form beans in request and thus enables thread safety. On each page of the wizard, you update the DVO with the values in the form bean and only keep the DVO in session. I agree with Craig when he says that the form bean should only be kept in request scope. Rgs Vikram -----Original Message----- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 14:17 To: Struts Users Mailing List Subject: Re: thread safety On Wed, 12 Jun 2002, Noah Levitt wrote: > Date: Wed, 12 Jun 2002 19:57:39 -0400 > From: Noah Levitt <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: thread safety > > Hello struts users, > > The issue of thread safety bugs me. It seems as though it is > standard practice to write servlets thread-*unsafely*. The > odds of it ever being a problem are slim, but still. > > It seems to me that form bean setters (and probably getters) > should be synchronized. I found the following two quotes > from Craig McClanahan. To me, they seem contradictory. > However, even if we use the "that's going to be real > unusual" standard, shouldn't we synchronize setters, since, > in theory, it's the only thread-safe thing to do? > > http://archive.covalent.net/jakarta/struts-dev/2000/06/0117.xml > > Craig: > "For the form beans, you are creating them in a particular > user's session. If the user does two submits to the same > form at the same time you might have overlapping setXxx > method calls going on, but that's going to be real > unusual." > > http://archive.covalent.net/jakarta/struts-user/2001/03/0013.xml > > Craig: > "It is surprisingly easy to have multiple requests active > at the same time for the same session." > 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 > > Noah > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>