Hi,
Am Donnerstag, den 06.12.2007, 10:48 +0100 schrieb Bertrand Delacretaz:
> There's also commons-validator, I'm not familiar with it though:
> http://commons.apache.org/validator/
Ah, good point. I will look at that, whether we can leverage it. Thanks.
> We could also simply use the script name, e.g. "validation.js" to
> indicate its role, that's consistent with what we do now with POST.js,
> html.js, etc.
Makes sense.
> > ...The ValidationService internally manages the validator selection and
> > call. The validate method returns null if the input validates
> > successfully. Otherwise an Errors instance is returned which may be
> > inspected and from which a response may be generated to send back to the
> > client....
>
> Sounds good, and we should use subclasses of Errors like
> RequiredParameterMissing, BadNumberFormat, etc.
Actually the Errors object is a collection of issues raising from the
validation. The validator packs all issues it finds into the Errors
collection. So it would rather be:
errors.add(requiredParameterMissing("xyz"));
errors.add(badNumberFormat("name", wrongValue));
> One idea (that doesn't impact the overall design): if we can use
> javascript to define validation scripts, they might be useful on both
> the client and server sides.
I am not sure, because the API might be different on client and server
side. But if we can do something, why not. But I would not see this as a
blocker.
Regards
Felix