I'm not sure, but try and make sure that a) your object is
serializable,b) that it has a working equals/ hashCode based on
something that works well for objects in a collection, c) that all the
above is actually doing what you hope it is in the DB and, finally, d)
that you call setMaster on the page when youve updated the object
(unless of course youre resetting the object graph on pageBeginRender
each time)

Peace,
Josh



On 10/11/06, pipothebit <[EMAIL PROTECTED]> wrote:
hellow and sorry for my english,
I am novice tapestry user and I have a problem with a master detail
relation.

I have a simple bean like this:

...
public class Master imelements Serializable {
  private String name;
  private List<Detail> detail = new ArrayList<Detail>();
.....
.....
}
...


I need to do all the operations in a single page and the code is like
this:

...
<form jwcid="@Form" success="listener:doSubmit">
  <input jwcid="@TextField" value="ognl:master.name" size="40"/>
  <a href="#" jwcid="@DirectLink" listener="listener:addAction">add</a>
  <table>
    <tr>
      <td colspan="2">value</td>
    </tr>
    <tr jwcid="@For" source="ognl:master.detail" value="ognl:item"
element="tr" index="ognl:index">
      <td>
        <input jwcid="@TextField" type="text" size="40"
value="ognl:item.value"/>
      </td>
      <td>
        <a href="#" jwcid="@DirectLink" listener="listener:delAction"
parameters="ognl:{index}">del</a>
      </td>
    </tr>
  </table>
  <input type="submit" value="Submit"/>
...
...
</form>
...

The java code of the page is like this:

...
public abstract class MasterDetail extends BasePage {
  @Persist
  public abstract Master getMaster();
  public abstract void setMaster(Master master);

  public void addAction() throws Exception {
    getMaster().getDetail().add(new Detail());
  }

  public void delAction(int index) throws Exception {
    getMaster().getDetail().remove(index);
  }

  @InjectPage("ListPage")
  public abstract ListPage getListPage();
  public IPage doSubmit() throws Exception {
    ...
    ... Database
    ...
    return getListPage();
  }
}

All work fine except when I add a new Detail to de Master record. In
that case the Master bean do not get the state saved previously, that
is, I enter a name and when I pres the "add" link to add a new Detail
the Master bean is reseted. The empty element is added to de Detail List
but all previos values of the bean are lost. But when I enter values to
all fields and press the submit button the values are correctly saved.

Can some one help me?
very thank you.



______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to