Oh c'mon guys, is there really no one able to help with this?
I would really appreciate it! Thanks a lot.
Or at least could you point me to some COMPREHENSIVE info about validation
and indexing? (not the struts site please:)

Radek

> -----Original Message-----
> From: Václavík Radek [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 18, 2004 12:44 PM
> To: '[EMAIL PROTECTED]'
> Subject: Indexed list validation
> 
> 
> Hi all,
> 
> this is probably a constantly discussed topic and I have 
> surely found a load
> of inromation concerning this,but it still did not solve my problem.
> 
> I have a web page which displays multiple records, each 
> record representing
> one person. I am using index to retrieve each record.
> 
> The person is represented by bean Person:
> 
> public class Person {
>       .
>       .
>       private int monthlySalary;
> 
>       public int getMonthlySalary() {
>               return monthlySalary;
>       }
>       public void setMonthlySalary(int monthlySalary) {
>               this.monthlySalary = monthlySalary;
>       }
>       .
>       .
> }
> 
> 
> I use this form for the action called:
> 
> public final class PersonalForm extends ValidatorForm{
>       .
>       .
>       private List persons;
> 
>       public Person getPersons(int index) {
>               return (Person)persons.get(index);
>       }
>       public void setPersons(int index, Person value) {
>               persons.set(index, value);
>       }
>       .
>       .
> }
> 
> and in the JSP, it looks like this:
> 
> <logic:iterate id="person" name="personalForm" property="persons"
> indexId="index">
>       .
>       .
> <html:text name="personalForm"
> property='<%="persons["+index+"].monthlySalary"%>'
> styleClass="monthlySalary"/>
>       .
>       .
> </logic:iterate>
> 
> Everything works just fine. What doesn't work is the validation.
> 
> I have validation.xml looking like this:
> 
> <form name="personalForm">
>                       <field property="monthlySalary"
>                                       indexedListProperty="persons"
>                                       depends="integer">
>                       <arg0   key="errors.integer"/>
>                       </field>
> </form>
> 
> 
> When the page is loaded, i get the following exception in Tomcat:
> 
> ERROR: in validateField
> java.lang.NoSuchMethodException: Unknown property 'monthlySalary'
>         at
> org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(Property
> Utils.java:1175)
>         at
> org.apache.commons.beanutils.PropertyUtils.getNestedProperty(Property
> Utils.java:772)
>       .
>       .
> 
> 
> Where am I making mistake?
> 
> Thanks for suggetions.
> 
> Radek
> 
> _____________________________
> 
> Ing. Radek Václavík
> ICS Department - webmaster
> 
> ZeNTIVA a.s.
> U Kabelovny 130, 102 37 Praha 10
> Czech Republic
> tel. +420 267 243 296
> _____________________________
> 
> 

Reply via email to