can anybody provide an example of validation for nested indexed properties?

i've included the following form definition within validation.xml, but it causes NoSuchMethodExceptions to be thrown for each field with the message "Property 'ip' has no getter method".

now that's just completely untrue; form population works, my action can get the expected data out of the form, etc. i must just be configuring the form fields incorrectly.

also- in the associated jsp, i'm using logic:messagesPresent to determine if the validator has set an error message. is this the correct syntax (below)?

thanks!

---- form definition in validation.xml

<form name="NewPlatformForm">
  <field property="address" indexedListProperty="ip" depends="required">
    <msg name="required" key="error.IpAddressIsRequired"/>
  </field>

  <field property="netmask" indexedListProperty="ip" depends="required">
    <msg name="required" key="error.NetmaskIsRequired"/>
  </field>
</form>

---- accessors

    public IpValue getIp(int index) {
        if (index >= ips.length || this.ips[index] == null) {
            setIp(index, new IpValue());
        }
        return this.ips[index];
    }

    public void setIp(int index, IpValue ip) {
        if (index >= ips.length) {
            IpValue[] newIps = new IpValue[index+1];
            System.arraycopy(ips, 0, newIps, 0, ips.length);
            newIps[index] = ip;
            this.ips = newIps;
        }
        else {
            ips[index] = ip;
        }
    }

---- jsp

<c:forEach var="i" varStatus="status" begin="0" end="${ipCount-1}">
  <logic:messagesPresent property="ip[${i}].address">
    <html:errors property="ip[${i}].address"/>
  </logic:messagesPresent>
</c:forEach>


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to