Let's assume I have a Person class:

public class Person {
  public String getFirstname();
  public String getLastname();
  public Address getAddress();
  ...
}

and an Address class:

public class Address {
  public String getStreet();
  public String getTown();
  ...
}

I am building a form interface for editing a Person, with this binding:

<fb:value id="street" path="address/street"/>

Now, when trying to save the form, JXPath will do a jxpathContext.createPathAndSetValue which will fail because person.getAddress() is null and the JXPath context doesn't know how to create an Address.

I could work around this problem by making sure person.address is not null before loading it into the form, but I don't like this solution. A better option, maybe, would be setting a factory on the context, like is shown here: http://jakarta.apache.org/commons/jxpath/users- guide.html#Creating%20Objects

My problem is: where do I set this factory in CForms, assuming this is possible at all?

        Thanks in Advance,

                Ugo

--
Ugo Cei
Tech Blog: http://agylen.com/
Open Source Zone: http://oszone.org/
Wine & Food Blog: http://www.divinocibo.it/

Reply via email to