commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Keeling <>
Subject Selective Validation
Date Thu, 27 Apr 2006 14:21:14 GMT
Hi guys,
I have a commons validator question - I am autogenerating all my pojos 
using xdoclet I can add the validator tags to the xdt so they will be 
applied to all the setters, this is an example output which is great.

   * Setter method for objectClass
   * @spring.validator type="required"
   * @spring.validator type="mask" msgkey="errors.objectClass"
   * @spring.validator-var name="mask" value="${objectClass}"
   public void setObjectClass(java.lang.String objectClassvalue){
       this.objectClass = objectClassvalue;

When I run the webdoclet task this is successfully put into 
validation.xml, the problem is that not all the fields in my JSP are 
required, I dont even display them so they are never submitted. My 
question is can I get commons validator to only validate submitted 
fields and not try and validate the entire form in validation.xml

If for example I have the following in validation.xml but I only wanted 
to submit city and ignore everything else for that form - is this 
possible? Hope I have explained this so you understand ;-)

     <form name="address">
             <field property="city"
                <arg0 key=""/>
             <field property="country"
                 <arg0 key=""/>
             <field property="province"
                 <arg0 key="address.province"/>

Thanks as ever,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message