http://cocoon.apache.org/2.1/userdocs/forms/binding.html#fb%3Ainsert-bean

try something along the lines of
<fb:insert-bean classname="GeoCoordinate" addmethod="setLatitude" />

before the <fb:value> stuff on the latitude

this assumes that GeoCoordinate has a constructor that doesn't require any arguments, and that your SightingReport has a setLatitude(GeoCoordinate) method (the latter is already assumed by the use of jxpath per the paths in your snippet)

alternatively you could indeed use the javascript or custom binding
(the first probably somewhat easier)

HTH,
-marc=

Benoit Deshaies wrote:
Hi,

I was wondering what was the simplest way to use the Forms Binding
Framework to create new objects. I have the following Java model I
created a form for:

public class SightingReport {
   private String birdName;
   private GeoCoordinate latitude;
   // gets/sets
}

public class GeoCoordinate {
   private int deg;
   private int min;
   private int sec;
   // gets/sets
}

SightingReport.latitude is initialized to null. My binding file looks
like this:

<fb:context path="/" >
  <fb:value id="birdName" path="birdName"/>
  <fb:value id="latDeg" path="latitude/deg"/>
  <fb:value id="latMin" path="latitude/min"/>
  <fb:value id="latSec" path="latitude/sec"/>
</fb:context>

When I invoke form.save(sightingReport), I get the following error:
Exception trying to create xpath latitude/deg; Factory is not set on
the JXPathContext - cannot create path: /latitude.

What would be The Best Way to initialize the latitude object (invoke
default constructor) ?  <fb:javascript> ? <fb:custom> ?

Many thanks,

Benoit Deshaies




__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/


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


-- Marc Portier http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center Read my weblog at http://blogs.cocoondev.org/mpo/ [EMAIL PROTECTED] [EMAIL PROTECTED]

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



Reply via email to