From: "Yansheng Lin" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Subject: RE: validation philosophical question Date: Thu, 14 Aug 2003 11:29:11 -0600
Agreed mostly, but...
what happens when you want to change some validation rules? You have to change
two or more places instead of one if you choose to use other validation methods
instead of keeping everything inside the validator framework. The goal of
validator framework is to eliminate these redundancy. Making sure everything is
kept inside of the config file, you only need to modify one place.
- Yansheng
-----Original Message----- From: Adam Levine [mailto:[EMAIL PROTECTED] Sent: August 14, 2003 10:43 AM To: [EMAIL PROTECTED] Subject: Re: validation philosophical question
My personal preference is there should be as little reliance on the front-side as possible. I personally hate little JS boxes popping up at me "this entry isn't right.. fix it!", and much prefer a submit-correct cycle with quiet, unobtrusive indicators showing me what I need to change.
If you insist on front-side validation (which, yes, can make the user experience better), you should ALWAYS have backup/duplicate server-side validation.. otherwise, what happens for the browsers/users who 1) don't have JS enabled, 2) don't have JS functionality ?
As for where the appropriate place is business side.. That's dependent upon your system design. My Actions merely act as a gateway to business objects that handle data validation. If the data isn't right, I aggregate a list of custom exceptions ('UserLoginNameAlreadyExistsException') to be handed back to the Action caller, and return to the caller w/o performing any more business logic. The action caller checks that list for entries, and accumulates form field error messages appropriately, and then forwards/returns (actionmapping) to the entry page.
if the business logic generates no custom exceptions, i perform the business logic as appropriate (ie, updating/creating an entity bean, and return an empty list to the caller.
if i have a system level problem (EJB/JNDI/something systematic that just doesn't work), I throw a custom generic exception (ie, UserCreationException) for the calling process to catch. the action can then populate the errors with a generic process error message ("there was a system problem trying to create your account. try again or send an email to....").
The point of all this is my data validation is kept in one place so I can swap the interface as needed. The only commonality between all interfaces would be the use of an ActionForm and a List to hold returned validation 'exceptions'. And I have no problem with that. the Form is just a POJO for all intents and purposes, as it should be. This leaves my interface to be business logic stupid, but interface/UI logic smart.
my $0.02.
From: "David Thielen" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "Struts-Users" <[EMAIL PROTECTED]> Subject: validation philosophical question Date: Thu, 14 Aug 2003 10:31:27 -0600
Hi;
Everyone who hits my site has a high-speed connection. So I am thinking that it makes sense to do server side validation only as that provides a better method than the javascript pop-ups.
And in this case, it seems to me that the logical place for all validation then is inside the ActionForm validate method.
comments?
thanks - dave
_________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
--------------------------------------------------------------------- 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]
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]