One of the key uses of ActionForm classes is to do field validation. Often, this 
validation is simple data-type checking, or verifying that fields are non-null.

It seems like 80% of the validation tasks could be done by adding one or two simple 
optional parameters to form tags. This would allow the view to be more completely 
located in the JSPs, rather than have some presentation code be in the JSP and other 
presentation issues -- the validation -- be in the ActionForm. Putting as much of the 
view as possible in the JSP would more effectively separate developer roles, be better 
coupling, etc.

Form tags could have simple optional parameters that do things like:
o Specify that a tag value be non-null
o Specify the field's "validation data type"

Data type validators could be specified in the configuation file, in the tag handling 
code, or in special Java classes. The tags might look something like:

<html:text name="employee" property="snn" datatype="SSN" nullsallowed="false"/>

This would specify that this field be validated under the "SSN" set of rules. In this 
case, the validation rules could check for the 999-99-9999 format. If validation 
fails, the error would be stored and displayed as usual.

You would only need a small library of such data type validation rules to cover most 
situations. For more sophisticated validation the programmer is free to code the 
"validate" routine in an ActionForm.

--
Sent via jApache.org

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

Reply via email to