There isn't anything different you need to do from normal validation.

http://struts.apache.org/userGuide/dev_validator.html

The only issue you might hit is if you want to validate according to the
Action Mapping's path, rather than the form name. Then you would need a
custom ActionForm - but thats very straight forward. Just extend either
BeanValidatorForm or LazyValidatorForm and instantiate the LazyDynaMap in
the constructor and fix the validation key (use setPathValidation(true)
method) to use the mapping's path. Something like...

public class MyLazyForm extends LazyValidatorForm() {
    public MyLazyForm() {
        super(new LazyDynaMap());
        setPathValidation(true);
    }
}

Some people don't like using the setPathValidation() because
BeanValidatorForm automatically removes the leading "/" - if thats the case
you can just override getValidationKey() method....

    public String getValidationKey(ActionMapping mapping,
                                   HttpServletRequest request) {
         return mapping.getPath();
    }

Obviously in your struts-config you need to specify this new form....

 <form-bean name="mapForm" type="myPackage.MyLazyForm"/>

Niall

----- Original Message ----- 
From: "Andrew Waite" <[EMAIL PROTECTED]>
Sent: Saturday, February 12, 2005 10:50 PM

> Thanks for the response. This is looking promising - excellent work, btw.
>
> I have the Action and Struts communicating with this "form".  Do you
> have any example of how to apply the Validaror against it?  Looking
> for some samples but given how new this is it's hard to come by.
>
> Thanks,
> Andrew



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

Reply via email to