| <?xml version="1.0"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <!-- 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. --> |
| |
| <fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" path="/" > |
| |
| <!-- the email value will not be saved because of the @direction="load" --> |
| <fb:value id="email" path="email" direction="load"/> |
| <fb:value id="ipaddress" path="ipAddress"/> |
| <fb:value id="birthday" path="birthday"/> |
| <fb:value id="number" path="aNumber"/> |
| <fb:value id="choose" path="choose"/> |
| <fb: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. --> |
| <fb:aggregate id="phone" path="." > |
| <fb:value id="number" path="phoneNumber"/> |
| <fb:value id="zone" path="phoneZone"/> |
| <fb:value id="cntr" path="phoneCountry"/> |
| </fb:aggregate> |
| |
| <fb: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) --> |
| <fb:repeater id="contacts" |
| parent-path="." |
| row-path="contacts"> |
| |
| <!-- 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 --> |
| |
| <fb:identity> |
| <fb:value id="id" path="@id"/> |
| </fb:identity> |
| |
| <fb:on-bind> |
| <!-- executed on updates AND right after the insert --> |
| <fb:value id="firstname" path="firstName"/> |
| <fb:value id="lastname" path="lastName"/> |
| <fb:value id="phone" path="phone"/> |
| <fb:value id="email" path="email"/> |
| </fb:on-bind> |
| |
| <fb:on-delete-row> |
| <fb:delete-node/> |
| </fb:on-delete-row> |
| |
| <fb:on-insert-row> |
| <fb:insert-bean |
| classname="org.apache.cocoon.forms.samples.Contact" |
| addmethod="addContact"/> |
| </fb:on-insert-row> |
| </fb:repeater> |
| |
| </fb:context> |