| <?xml version="1.0"?> |
| <!-- Example binding to bind the "form2" form to the bean "Form2Bean" --> |
| |
| <!-- The id attributes on the elements in this file map to widgets in the |
| form definition. The path attributes are JXPath expressions addressing |
| properties of the bean. --> |
| |
| <!-- It would be an interesting exercise to generate this file from |
| javadoc-tags in the bean using an xdoclet-like approach. --> |
| |
| <wb:context xmlns:wb="http://apache.org/cocoon/woody/binding/1.0" path="/" > |
| |
| <!-- the email value will not be saved because of the @direction="load" --> |
| <wb:value id="email" path="email" direction="load"/> |
| <wb:value id="ipaddress" path="ipAddress"/> |
| <wb:value id="birthday" path="birthday"/> |
| <wb:value id="number" path="aNumber"/> |
| <wb:value id="choose" path="choose"/> |
| <wb:value id="sex" path="sex"/> |
| |
| <!-- An aggregatefield is a special kind of widget that lets |
| the user edit the value of multiple widgets through one text box |
| (see also the form definition for how this works). In this case |
| it is used to map the different parts of a phone number to different |
| bean properties. --> |
| <wb:aggregate id="phone" path="." > |
| <wb:value id="number" path="phoneNumber"/> |
| <wb:value id="zone" path="phoneZone"/> |
| <wb:value id="cntr" path="phoneCountry"/> |
| </wb:aggregate> |
| |
| <wb:multi-value id="drinks" parent-path="." row-path="drinks" direction="load"/> |
| |
| <!-- repeater requires unique identification mechanism of the row-nodes --> |
| <!-- (it is of course possible to implement other binding strategies) --> |
| <wb:repeater id="contacts" |
| parent-path="." |
| row-path="contacts" |
| unique-row-id="id" |
| unique-path="@id"> |
| |
| <!-- compare to xml-binding: the convertor is not needed here --> |
| |
| <!-- important note: the row-path is used inside jxpath-createPath context, |
| as a consequence it cannot have dependent children or predicates --> |
| |
| <wb:on-bind> |
| <!-- executed on updates AND right after the insert --> |
| <wb:value id="firstname" path="firstName"/> |
| <wb:value id="lastname" path="lastName"/> |
| <wb:value id="phone" path="phone"/> |
| <wb:value id="email" path="email"/> |
| </wb:on-bind> |
| |
| <wb:on-delete-row> |
| <wb:delete-node/> |
| </wb:on-delete-row> |
| |
| <wb:on-insert-row> |
| <wb:insert-bean |
| classname="org.apache.cocoon.woody.samples.Contact" |
| addmethod="addContact"/> |
| </wb:on-insert-row> |
| </wb:repeater> |
| |
| </wb:context> |