This came up a lot when I was teaching and our current customers ask it
a lot too, especially with Struts. What I tell them is to validate
everywhere it makes sense. What that means is that if it makes sense to
validate via javascript, do it. If you want/need model layer validation,
do it (I prefer this anyway personally). And validate at the db layer as
well (referential integrity and such). 

We have one client that has a business model that is used across client
types (both swing and struts) and therefore they definitely have
validation in their business objects. On the struts side, they also use
validation for things like making sure an input is a number, isn't
'null', etc. which can be done at the client via javascript thus saving
a trip to the server. That would equate to input type of validation as
opposed to business validation.

If you only want to validate in one place, I would do it in the business
object as it is the most reusable (assuming you aren't using dynabeans
:-) ).

- Robert

-----Original Message-----
From: David Graham [mailto:dgraham1980@;hotmail.com] 
Sent: Wednesday, October 23, 2002 3:43 PM
To: [EMAIL PROTECTED]
Subject: Validation Philosophy

I just presented Struts to my team as a strategic solution and it went
very 
well.  I got beat up on the validation though and didn't have a good
answer. 
  I explained how the validator works with action forms and how all your

input is validated before it gets to the business layer but that wasn't 
sufficient.

A few people argued that they want the validation in the model objects
so 
every app that uses the model must follow those rules.  They said that 
having the validation before the model didn't make sense.

I'd really appreciate any arguments against this approach (or maybe
they're 
right).

Thanks,
David





_________________________________________________________________
Unlimited Internet access for only $21.95/month.  Try MSN! 
http://resourcecenter.msn.com/access/plans/2monthsfree.asp


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to