I hope I understand what you are asking.  A couple of things come to mind about 
threads and Servlets.  If one uses Instance variables in Servlets then each 
instance of that Servlet has a unique variable and there is no data corruption. 
 However if one uses Class variables then each instance of a servlet shares the 
variables and then data corruption can occur. 

Same with formbeans and wizards.  Each formbean is unique to the specific 
Servlet action.  So, if one uses a single formbean for several steps in a 
wizard then there is no data corruption.

Am I understanding what you are asking?

--Brad. 



-----Original Message-----
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Wed 11/16/2005 11:46 AM
To: Struts Users Mailing List
Subject: Wizard page "data corruption" (was: "Re: Form Beans")
 
Imagine you have a single ActionForm with a firstName field.  Now 
imagine you have two wizard pages that are used in sequence, and you 
want to use the same ActionForm for both.

Assume the form is stored in session, as you would expect in a wizard.

Now, imagine there is a firstName field on both HTML forms of both 
wizard pages... you might argue this isn't a good wizard design, and I 
would tend to agree, but it's something that can happen in some cases.

Now, assume a prototypical Struts app, no Struts Dialogs extensions or 
anything...

What happens when the first page submits?  The firstName field is 
populated in the ActionForm.  Now what about when the second form is 
submitted?  The value of the firstName field in the ActionForm now has 
the value from the second form submission, effectively overwriting the 
value the user entered on the first page, so if the user were to go back 
to the first wizard page, they would incorrectly see the data from the 
second page in effect.  Easily to explain, but to the user it's a data 
corruption issue.

This is the scenario I was referring to.  Does your Dialogs stuff 
overcome that?  If so, how?  Whether it does or not, a "normal" Struts 
app will certainly have this problem, hence my comment about making sure 
the field names are different... in this case, it might be as simple as 
making two fields in the ActionForm, one named firstNamePage1 and 
firstNamePage2.

Frank

Michael Jouravlev wrote:
> On 11/16/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
> 
>>The one thing to keep in mind if you go [one ActionForm] route is
>>to be sure you don't have a field on one page
>>with the same name as another.  I had one junior developer make that
>>mistake and it drove him nuts trying to figure out what was wrong
>>(obvious in retrospect, but one of those "tricky at the time" problems
>>to solve).
> 
> 
> I don't see right away how does this matter if you have separate
> submits from a browser each time. Also would not matter if you
> redirect between pages and don't intentionally stuff values into
> redirected request. Redirected request comes clean, so same fields or
> not - does not matter. This is why my two-phase request processing
> works: POST comes with input data, form is populated, then I redirect
> to the same action again, GET comes clean, form is not updated because
> request contains no data.
> 
> Forwarded request brings all input data with it, and Struts applies
> this data to another form. Been there ;)
> 
> Michael.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]

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



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

Reply via email to