cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicole Hochleiter <>
Subject CForms, binding with repeater, new element overwrites old element
Date Tue, 06 Jul 2004 15:21:29 GMT
In stepping through org.apache.cocoon.forms.binding.RepeaterJXPathBinding 
public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException

I got the impression, that my new added element overwrites an existing one.

I'm working with bean binding, cocoon.2.1.5, Java 1.4.2.

Is it a bug or did I miss something in the configuration?

I got the idea that this is a bug, because I could fix this 'bug' in my special
case in putting some lines into that class,  like:
(but I do not want to keep it)
  //register the factory!
  while (rowIterator.hasNext()) {
      Repeater.RepeaterRow thisRow = (Repeater.RepeaterRow);
      // Perform the insert row binding.
      this.insertRowBinding.saveFormToModel(repeater, repeaterContext);
      // -->  create the path to let the context be created

      // -------- My FIX: the pointer pointed always to the last element, 
      // whicht not automatically was the new one
      Pointer newRowContextPointer = null;
      for (int i=0 ; i <= indexCount; i++) {
        newRowContextPointer = 
          repeaterContext.createPath(this.rowPathForInsert + "[" + i + "]");
        Object valueObject = newRowContextPointer.getValue();
        // here is where I check if it really is new (but it only works 
        // with my objectmodel
        if (valueObject instanceof ONStructureElement) {
          if (((ONStructureElement)valueObject).isNew() && 

      // this was the original line
      /*Pointer newRowContextPointer = repeaterContext.createPath(
              this.rowPathForInsert + "[" + indexCount + "]"); */
      // -------- END My FIX

      JXPathContext newRowContext =
      if (getLogger().isDebugEnabled()) {
          getLogger().debug("inserted row at " + newRowContextPointer.asPath());
      //    + rebind to children for update
      this.rowBinding.saveFormToModel(thisRow, newRowContext);
      getLogger().debug("bound new row");

Is it really a bug or can I fix my problem in configuring something?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message