The Validator framework (commons-validator) comes with the struts
distribution.

To install it you will need: jakarta-oro, commons-beanutils,
commons-logging, commons-collections, commons-digester.

Put these files (.jar) on your WEB-INF/lib (if you already installed
struts it will only be missing the jakarta-oro.jar and
commons-validator.jar).

Configure your validation-rules.xml , validation.xml (better have an
example to start with... And download the dtds of these files... You may
need them.) and configure your struts-config.xml (the one had you seemed
ok).

Place the dtd files on a webapp directory (for example: /WEB-INF/dtd).
Change the validation-rules.xml and validation.xml DOCTYPE element (in
case you are developing without an internet connection, at the server
startup it tries to validate the 2 files - tries to retrive
http://jakarta.apache.org.../file.dtd - if the container doesn�t find
these files an error occurs )...

Example: for validation.xml

<?xml version="1.0"?>
<!DOCTYPE form-validation
 SYSTEM
"/Library/Tomcat/Home/webapps/mywebapp/WEB-INF/dtds/validation_1_1.dtd">
<form-validation>
...
</form-validation>

You also have to include some properties on your webapp message resources:
   errors.required={0} is required.
   errors.minlength={0} can not be less than {1} characters.
   errors.maxlength={0} can not be greater than {1} characters.
   errors.invalid={0} is invalid.

   errors.byte={0} must be a byte.
   errors.short={0} must be a short.
   errors.integer={0} must be an integer.
   errors.long={0} must be a long.
   errors.float={0} must be a float.
   errors.double={0} must be a double.

   errors.date={0} is not a date.
   errors.range={0} is not in the range {1} through {2}.
   errors.creditcard={0} is an invalid credit card number.
   errors.email={0} is an invalid e-mail address.

These were all the steps I had to make...

Good luck :)

Pedro Salgado

On 15/06/2003 18:09, "Thomas Miskiewicz" <[EMAIL PROTECTED]> wrote:

> Dan,
>
>> change your strut config to use
>> org.apache.struts.validator.DynaValidatorForm
> That helped. Could you or someone please else answer my
> questions regarding the validator framework itself?
> Is it part of Struts framework or not (I'm using the 1.1 rc2).
> What steps are required to setup and use it?
> Where do I find more info about it.
>
> Thanks
> Tom
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to