struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Levine" <adam_l_lev...@hotmail.com>
Subject Re: validation philosophical question
Date Thu, 14 Aug 2003 16:52:33 GMT
addendum.. not only do i put in the "userloginalreadyexistsexception", but 
also the pure data validation( "EmailAddressFormatNotGoodException" for 
malformed, "EmailAddressRequiredException" for blank, etc)


From: "Adam Levine" <adam_l_levine@hotmail.com>
Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
To: struts-user@jakarta.apache.org
Subject: Re: validation philosophical question
Date: Thu, 14 Aug 2003 11:43:00 -0500

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" <dave@windward.net>
Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
To: "Struts-Users" <struts-user@jakarta.apache.org>
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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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


Mime
View raw message