You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Alexandre Torres <al...@gmail.com> on 2005/04/27 16:44:10 UTC

Validator with tree levels of collections

I'm using commons validator with struts. My validator form got a little more 
tricky...
I have a component with class FormA that has a set of components of
class RowB that has a set of componens RowC. Something like

FormA {
public String getCode() {
}
public void setCode() {
}
public Vector getBRows() {
...
}
public void setBRows(Vector v) {
...
}
}

RowB {
public String getName() {
}
public void setName(String n) {
...
}
public Vector getCRows() {
...
}
public void setCRows(Vector v) {
...
}

}

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

I want to define a rule in validator where all "name" instances of
RowC,RowB and FormA should be required.
For FormA's property "code" I did:
..
<field property="code" depends="required">
<arg key="forma.code.displayname" />
</field>
..
to RowB I coded, using the example of Niall

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

But , for RowC I could not figure out how to make it, since I may have
zero, one or more RowC values... can I use indexedListProperty="rowsB.rowsC" 
?

Thanks.