> -----Original Message-----
> From: Marco Tedone [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 07, 2004 10:37 AM
> To: Struts Users Mailing List
> Subject: Re: A couple of questions
> 
> 
> 
> 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.
> 
> I'm not saying that is not nice, but I wouldn't say that it's 
> necessarily
> cleaner and easier. A shared utility function written in 
> Javascript for form
> validations on the client side would do, without having to 
> create form (Dyna
> or not) objects each time. What about the objects when a form 
> is posted?

With a simple tag, I voila have client side javascript validation.  Or server side... 
and if they have JS turned off... I still fall back to server side because it's all 
handled for me by the validation framework.

What do you mean when the form is posted?

> Does  this mean that the form values will be written and in 
> the request
> object and it the ActionForm object? Or, when the request is 
> send, it gets
> intercepted by Struts which populates a form object? In both 
> case, what you
> save with another layer of indirection, you lose in 
> performance, don't you
> think?

When it comes to performance vs. maintainability, I always choose maintainability.  
It's always cheaper to buy better hardware, or add servers, then it is to create 
something that is hard to maintain.  My time is generally far more expensive then the 
extra server.  Billing at 50-100 per hour, for every change or spend 3k for an extra 
server?  No brainer to me.
Yes I've had clients terminate contracts because I pointed this out to them.  I have 
always been ecstatic that they did so, because they generally turned into nightmare 
clients for whoever they found after me. YMMV.
However you are right... you have the form AND the request object as is if you need it.



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

Reply via email to