Thursday, August 04, 2005

Native support for binding "complex" properties in Cocoon Forms

This is a good news for all those Cocoon guys.

Cocoon Forms has now a "native" support for "complex" properties and JXPath factories.
Simply implement your JXPath factory, as shown in my previous post, and configure it in you binding, without adding any other class.

Take a look at this XML snippet showing a binding example:


<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
path="/">

<fb:value id="name" path="name"/>
<fb:value id="surname" path="surname"/>

<fb:context path="residence" factory="com.example.AddressFactory">
<fb:value id="street" path="street"/>
</fb:context>

</fb:context>

As you can see, you must configure your factory class inside a "factory" attribute of an enclosing context element;
enclosed binding elements will automatically use this factory.

For using this new feature, you have to checkout the Cocoon revision 227024 or later, from:

http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/

It is in development, but is almost stable.

Have a nice Cocoon coding!

No comments: