You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Ansgar Weiss <an...@mgm-edv.de> on 2003/01/20 13:25:11 UTC
Conversion and Validation on non-String Properties using DynaValidatorForm (struts-1.1-b3)
Hi all...
I've been working with DynaValidatorForms for automated conversion of form
values to typed values (String, Integer, Date) in my data objects, and found
these features really useful. Then I tried to use server-side validation on
suc
h
a form and came into trouble with Dates:
First, the ActionForm is populated from the request, then the Validator is
invoked to validate the properties stored in that ActionForm (see
RequestProcessor>>process()). That means that the Converters try to parse
the
form values (e.g. the date) before the Validator is asked and throw
ConversionExceptions if a value has not an appropriate format.-(
Is there a clue I have missed or is that a systematic problem?
How about tying conversion and validation closer together?
- The form values get validated before conversion.
- The conversion could use validator cofiguration (like the datePattern), or
vice verse.
- A ConversionExceptions could be seen as a failed validation.
Thanks for your considerations!
Ansgar
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>