My first guess would be that your accessor methods are inconsistent:

  public List getBeneficiaries()
  public BeneficiaryVO getBeneficiaries(int index)
  public void setBeneficiaries(BeneficiaryVO beneficiaryVO)

The setter is wrong, which will confuse the property introspection. On the other hand, you said if you remove the indexed getter things start working, though that would still leave you with inconsistent method signatures, so I'm not sure.

What happens if you remove the setter instead? Change it to take a List argument? Change it to take a BeneficiaryVO and an index?

I always have to check what the JavaBeans spec requires for indexed properties, but if you make sure you follow those conventions you should be OK.

L.

Glenn wrote:
Thanks for the help its very appreciated.
This code has been working for over a year without any problems in a Java
1.4 and J2EE 1.3.
The LazyList hand cranking can be found here:
http://wiki.apache.org/struts/StrutsCatalogLazyList

Here are the plain methods in the InsuranceForm:

private BeneficiaryVO beneficiary = new BeneficiaryVO();

/**
* Methods to hand crank Beneficiary lazy list
*/
public List getBeneficiaries() {
  return beneficiaries;
}

public BeneficiaryVO getBeneficiaries(int index) {
  while (index >= beneficiaries.size()) {
     beneficiaries.add(new BeneficiaryVO());
  }

  return (BeneficiaryVO) beneficiaries.get(index);
}

public void setBeneficiaries(BeneficiaryVO beneficiaryVO) {
  beneficiaries.add(beneficiaryVO);
}
public void populateBeneficiaries(List beneficiaries) {
  this.beneficiaries.addAll(beneficiaries);
}

public void resetBeneficiaries(List beneficiaries) {
  this.beneficiaries = beneficiaries;
}

This is the error I get:[Servlet Error]-[action]: *
javax.servlet.jsp.el.ELException*: Unable to find a value for
"beneficiaries" in object of class "
hronline.secure.personal.insurances.InsuranceForm" using operator "."

I have debugged the code in the debugger and there is data in the
Beneficiaries list (just before exiting the ActionForm).
Also, the InsuranceForm has other attributes that are displayable.

Here is the wierd part... if I comment out this method:

public BeneficiaryVO getBeneficiaries(int index) {
  while (index >= beneficiaries.size()) {
     beneficiaries.add(new BeneficiaryVO());
  }

  return (BeneficiaryVO) beneficiaries.get(index);
}

the page is now displayed, no error. However the application won't work
since it needs the method to capture the submitted data.

What is going on? Any clues?

- Glenn



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

Reply via email to