You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by br...@apache.org on 2003/07/23 23:08:56 UTC
cvs commit: cocoon-2.1/src/blocks/woody/samples/forms form2_bind_bean.xml
bruno 2003/07/23 14:08:55
Modified: src/blocks/woody/samples/forms form2_bind_bean.xml
Log:
removed some stuff left from the xml binding and added some clarifications
Revision Changes Path
1.2 +35 -37 cocoon-2.1/src/blocks/woody/samples/forms/form2_bind_bean.xml
Index: form2_bind_bean.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form2_bind_bean.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- form2_bind_bean.xml 23 Jul 2003 15:18:22 -0000 1.1
+++ form2_bind_bean.xml 23 Jul 2003 21:08:55 -0000 1.2
@@ -1,59 +1,57 @@
<?xml version="1.0"?>
-<!-- Example to bind form2 form to Form2Bean -->
-<wb:context
- xmlns:wb="http://apache.org/cocoon/woody/binding/1.0"
- path="/" >
-
- <!-- the email value will not be saved because of the @readonly -->
- <wb:field id="email" path="email" readonly="true"/>
- <!-- jxpath binds to nodes as well as to attributes -->
- <!--
- <wb:field id="account" path="account/@size" />
- <wb:field id="number1" path="number" />
- -->
-
- <!-- one entry field in the client maps through aggregate fields -->
- <wb:aggregate id="phone" path="." >
- <!-- to multiple fields in the XML file -->
- <wb:field id="number" path="phoneNumber"/>
- <wb:field id="zone" path="phoneZone"/>
- <wb:field id="cntr" path="phoneCountry"/>
- </wb:aggregate>
-
-
- <wb:field id="ipaddress" path="ipAddress"/>
+<!-- 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 @readonly -->
+ <wb:field id="email" path="email" readonly="true"/>
+ <wb:field id="ipaddress" path="ipAddress"/>
+
+ <!-- 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:field id="number" path="phoneNumber"/>
+ <wb:field id="zone" path="phoneZone"/>
+ <wb:field id="cntr" path="phoneCountry"/>
+ </wb:aggregate>
<!-- 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"
- >
+ unique-path="@id">
+
<!-- important note: the row-path is used inside jxpath-createPath context,
- as a consequence it cannot have dependent children or predicates -->
+ as a consequence it cannot have dependent children or predicates -->
<wb:on-bind>
- <!-- executed on updates AND right after the insert -->
- <wb:field id="firstname" path="firstName" />
- <wb:field id="lastname" path="lastName" />
- <wb:field id="phone" path="phone" />
- <wb:field id="email" path="email" />
+ <!-- executed on updates AND right after the insert -->
+ <wb:field id="firstname" path="firstName"/>
+ <wb:field id="lastname" path="lastName"/>
+ <wb:field id="phone" path="phone"/>
+ <wb:field id="email" path="email"/>
</wb:on-bind>
<wb:on-delete-row>
- <!-- chose on of these to test -->
- <!--
- <wb:set-attribute name="row-state" value="deleted" />
- -->
- <wb:delete-node />
+ <wb:delete-node/>
</wb:on-delete-row>
<wb:on-insert-row>
<wb:insert-bean
classname="org.apache.cocoon.woody.samples.Contact"
- addmethod="addContact" />
+ addmethod="addContact"/>
</wb:on-insert-row>
</wb:repeater>