> Help
> Does anyone have a pointer to examples of multipage forms using Struts
> best design patterns, example code.
> 
> I'm thought there was an example on the Struts resources but I can't see it
> anywhere.
> I don't want to used something as complex as Workflow Extension by Matthias
> Bauer 

Maybe that's the reason why nobody answered the first time: My Workflow 
Extension is not at all complex. ;-)

Ok, let's turn to your question: I prefer to validate the form data in the 
action (this can happen by explicitly calling a form bean method validateXYZ() 
from the action). Here is why: Experience shows, that most often you need to 
compare the input to some values in a database or other external data source. 
And I guess you don't want to open up a database connection from the form bean 
to do the validation.

If you choose to go the same way it is easy to implement multiple validate 
methods that are invoked from the different actions.

If you do not want to do that because you prefer automatic validation you can 
implement the standard validation method like this

switch(actKey)
{
    case 1:
       validate1();
       break;
    case 2:
       validate2();
       break;
    case 3:
       validate3();
       break;
    default:
       validateAll();
       break;
}

and include a hidden field "actKey" in each of your forms. Now the standard 
validation method can decide (based on this field) which step you are in and can 
  call the appropriate validation method.

Hope that helps,

--- Matthias


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

Reply via email to