> -----Original Message-----
> From: Marco Tedone [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 07, 2004 10:06 AM
> To: Struts Users Mailing List
> Subject: Re: A couple of questions
> 
> 
> 
> ----- Original Message ----- 
> From: "Jim Barrows" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Tuesday, September 07, 2004 5:18 PM
> Subject: RE: A couple of questions
> 
> 
> 
> 
> 
> Because so much of what you're doing in processing the parameters is
> boilerplate.  Why not let the framework put it into an object 
> for you?  Then
> you can use the BeanUtils class to move it itno the VO directly.
> In much of my code I do:
> BeanUtils.copyProperties( dataVo, dataForm);
> and I'm done.  Your way would require a lot more code.
> 
> This is a good reason, for applications with long forms.

I use it for my login actions when I'm not using container managed security.
My typical worse case action is:

TheForm theForm = (TheForm) form;
ActionErrors errors = form.validate();
if( errors.isEmpty()) {
        errors = weirdValidations( form);
        if( errors.isEmpty()) {
                TheVo vo = new TheVo();
                BeanUtils.copyProperties( vo, theForm);
                getTheBusinessObject.doSomething( vo);
        } else {
                forward = forwardToError( errors);
        }
} else {
        forward = forwardToError( errors);
}

Now, I don't know about you, but this is much nicer, cleaner and easier to debug and 
maintain then having a whole bunch of validation code and copy code in the action.

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

Reply via email to