commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@blueyonder.co.uk>
Subject Re: commons validator: rule for array
Date Tue, 19 Apr 2005 13:43:37 GMT
You can use the indexedListProperty to do this. In your validation.xml you
would have something like the following...

      <field property="name" indexedListProperty="rows" depends="required">
        <arg key="forma.row.name.displayname" />
      </field>


Niall

----- Original Message ----- 
From: "Alexandre Torres" <alexandre.torres@gmail.com>
To: <commons-user@jakarta.apache.org>
Sent: Tuesday, April 19, 2005 1:43 PM
Subject: commons validator: rule for array


Hi. I'm using commons validator with struts.
I have a component with class FormA that has a set of components of
class RowB. Something like

FormA {
   public String getCode() {
   }
   public void setCode() {
   }
   public Vector getRows() {
...
   }
   public void setRows(Vector v) {
...
   }
}

RowB {
   public String getName() {
   }
   public void setName(String n) {
     ...
   }
}

I want to define a rule in validator where all "name" instances of
RowB should be required.
For FormA's property "code" I did:
..
      <field property="code" depends="required">
        <arg key="forma.code.displayname" />
      </field>
..
But , for RowB I could not figure out how to make it, since I may have
zero, one or more RowB values... I see in the example this:

      <field property="rows.name[0]" depends="required">
        <arg key="forma.row.name.displayname" />
      </field>
That validates only the first name in the set right ?
But if I have more than one name , what do I do ?

Thanks.

---------------------------------------------------------------------
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


Mime
View raw message