cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre Juffer <ajuf...@sun3.oulu.fi>
Subject repeater binding
Date Sun, 12 Nov 2006 14:21:02 GMT
Dear All,

As part of a larger form, I've the following very simple repeater (and 
associated repeater-actions):

<fd:repeater id="keywords" initial-size = "1">
   <fd:widgets>
     <fd:field id="keyword" required="true">
       <fd:label>Keywords</fd:label>
       <fd:datatype base="string" />
     </fd:field>
     <fd:booleanfield id="selection">
       <fd:initial-value>false</fd:initial-value>
       <fd:label>Select</fd:label>
     </fd:booleanfield>
   </fd:widgets>
</fd:repeater>
<fd:repeater-action id="add-keyword" command="add-row"
                         number-of-rows="1" repeater="keywords">
   <fd:label>Add keyword</fd:label>
</fd:repeater-action>
<fd:repeater-action id="remove-keyword" command="delete-rows"
                     number-of-rows="1" repeater="keywords"
                     select="selection">
   <fd:label>Remove selected</fd:label>
</fd:repeater-action>

In addition, the following binding has been constructed (based upon the 
sample in samples/blocks/forms/form2_bind_bean.xml):

<fb:repeater id="keywords" parent-path="." row-path="keywords">
   <fb:identity>
     <fb:value id="id" path="@id"/>
   </fb:identity>
   <fb:on-bind>
     <fb:value id="category" path="category" />
   </fb:on-bind>
   <fb:on-delete-row>
     <fb:delete-node/>
   </fb:on-delete-row>
   <fb:on-insert-row>
     <fb:insert-bean classname="Keyword" addmethod="addKeyword" />
   </fb:on-insert-row>
</fb:repeater>

Also the following class exists (stripped version):

public class Keyword {
     ....
     public Keyword(String keyword);
     public String getKeyword();
     ....
}

(There is no 'setKeyword(String keyword)' method.)

Another class (called 'Specification'), the actual bean, holds these 
keywords as a collection (Set) (stripped version):

public class Specification {
   ....
   public void addKeyword(Keyword keyword);
   public void removeKeyword(Keyword keyword);
   ....
}

The form displays itself correctly onto the screen, repeater works fine, 
etc. However, as soon as the Submit button is pressed, cocoon apparently 
ends up in an infinite loop. Nothing is logged in the log files (I run 
with the debug mode). The only thing I can do is to shutdown the servlet 
engine (tomcat 5.5.16).

I suppose the problem is in the binding. Specifically, if I remove the 
<fb:repeater> portion from the binding file, everything works (except of 
course I don't have the keywords saved).

I cannot see what the problem is. There must be something wrong with the 
repeater binding. I was hoping that somebody on this list may have a clue.

In addition, I am not entirely clear on how to remove a Keyword from the 
Specification (the bean). The binding includes an addmethod attribute 
for fb:on-insert-row, but there is no 'removemethod'. I could image to 
have a removemethod attribute for fb:on-delete-row. So, how exactly is 
this handled. Suppose the user returns to the Specification and wants to 
remove keywords. How is this then forwarded to the Specification bean. 
Also the

<fb:identity>
   <fb:value id="id" path="@id"/>
</fb:identity>

part is not clear to me. Is the id referring to the id of the repeater? 
And the path is referring to keyword (which has no id). Do I need this?

Thanks for your help,

-- 
Andre H. Juffer              | Email: Andre.Juffer@oulu.fi
The Biocenter and            | WWW: www.biochem.oulu.fi/Biocomputing/
     the Dep. of Biochemistry | Fax: +358-8-553-1141
University of Oulu, Finland  | Phone: +358-8-553 1161


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message