struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerry Jalenak" <Jerry.Jale...@LABONE.com>
Subject RE: [OT] Commons Validator JavaDoc
Date Thu, 26 Sep 2002 13:12:46 GMT
Cool!  This is exactly what I'm looking for!  

Jerry

> -----Original Message-----
> From: James Turner [mailto:turner@blackbear.com]
> Sent: Wednesday, September 25, 2002 6:50 PM
> To: Struts Users Mailing List
> Subject: Re: [OT] Commons Validator JavaDoc
> 
> 
> At 04:40 PM 9/25/2002, erry.Jalenak@LABONE.com wrote:
> 
> >Yeah, I have - it's a great example on how to write a custom 
> validation
> >method.  I'm trying to see if I can directly access 
> additional form fields
> >without having to specify each on as a <var>...</var> in my
> >application-rules.xml.
> >
> >Jerry
> 
> 
> Just added to validator, you can get access to the form from 
> a validation 
> rule by putting Validator in the method signature.  For example:
> 
> 
>   public static boolean validateLastNameIsBob(Object bean,
>        Field field,
>        Validator validator) {
>      Object form = validator.getResource(validator.BEAN_KEY);
>      String lastName = ValidatorUtil.getValueAsString(form, 
> "lastName);
>      if (lastName.equals("Bob") return true;
>      return false;
> }
> 
> If you look in the unit tests for Validator, you can see a 
> "requiredif" 
> validation I wrote that does generic cross-field validations 
> (i.e., last 
> name is required if first name is filled in).  I'll be 
> submitting as an 
> enhancement for Struts Validator soon.
> 
> James
> 
> 
> James
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:struts-user-help@jakarta.apache.org>
> 
> 

This transmission (and any information attached to it) may be confidential and is intended
solely for the use of the individual or entity to which it is addressed. If you are not the
intended recipient or the person responsible for delivering the transmission to the intended
recipient, be advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is strictly prohibited.
If you have received this transmission in error, please immediately notify LabOne at (800)388-4675.



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message