commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Graham <grahamdavid1...@yahoo.com>
Subject Re: VALIDATOR commons dynamic referencing in XML
Date Thu, 22 Jul 2004 13:29:16 GMT
--- John Ferron <johnferron@alliantenergy.com> wrote:
> Would you happen to have an example of this so I can look at it since
> I'm new to the commons api?

The Struts FieldChecks class is a good starting point.  All it does is
wrap various commons validator methods where yours would implement
something new.  The validation methods referenced in a Struts
application's validation.xml file are from FieldChecks.

David

> 
> John
> 
> >>> grahamdavid1980@yahoo.com 07/21/04 05:28PM >>>
> No, validator does not support pulling min/max values from an object. 
> But
> the nice thing about commons-validator is that it doesn't take much
> work
> to write your own reusable validation action that supports your custom
> use
> cases.  Basically, you just write a validation method that uses
> <var-name>
> and <var-value> values to get the bean's method name to call and
> configure
> your validation method in validation.xml as a <validator>.
> 
> David
> 
> --- John Ferron <johnferron@alliantenergy.com> wrote:
> > Hi,
> > 
> > I am working on a SWT/GUI (non-web based) application and I am
> looking
> > into using Validator for validation.  In looking into the examples
> and
> > source code, I noticed how you reference the actual values in the
> > validator-multipletest.xml
> >    <formset>
> >       <form    name="nameForm">
> >          <field    property="firstName"  depends="required">
> >          	     <arg0 key="nameForm.firstname.displayname"/>
> >          </field>    
> >          <field    property="lastName"
> >          	   depends="required,int">
> >          	     <arg0 key="nameForm.lastname.displayname"/>
> >          </field>
> >       </form>
> >    </formset>   
> > </form-validation>
> > 
> > or this example.
> > <field property="age" depends="isInt, checkRange">
> >      <arg0 key="nameForm.age" />
> >          <var>
> > 	<var-name>max</var-name>
> > 	<var-value>30</var-value>
> >          </var>
> >           <var>
> > 	<var-name>min</var-name>
> > 	<var-value>20</var-value>
> > </var>
> > 
> > One example is from the source found on the jakarta web site for the
> > commons validator zip file.  The bottom one is from a book from
> Apress
> > Publishing talking about using the Commons Validator.  What I would
> like
> > to do instead of hardcoding the value in the xml document, I want to
> > point to a JavaBean object and call a getMethod like getCurrentMax()
> and
> > check to see if it is within an absoluteMin and Max value.  I'm
> > wondering if this can be done.  Thanks.
> > 
> > John
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org 
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org 
> For additional commands, e-mail: commons-user-help@jakarta.apache.org 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 



	
		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message