cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: [Cforms] Correct syntax for binding bean in repeater?
Date Tue, 30 Nov 2004 20:57:57 GMT
> > <fb:context 
> xmlns:fb="" path="/">
> > 	<fb:repeater id="appointments" parent-path="."
> > row-path="lists/appointments">

> > If I change it into 
> > 	<fb:repeater id="appointments" parent-path="lists/appointments"
> > row-path=".">
> That one is wrong, the above one (parent-path pointing to 
> root bean and 
> row-path pointing to the list) is correct.
> > the "on-save" works, but the "on-load" doesn't do anything.
> > 
> > I can't think of anything else.
> You don't as you have one correct solution ;-) The 
> insert-bean specifies 
> a method and its parameter you must have in the context. Your 
> context is 
> the root bean, so you need a method add(AppointmentBean ab) 
> in your root 
> bean. This method adds the new AppointmentBean to the list of 
> appointments, something like:
> public void add(AppointmentBean ab) {
>      this.lists.appointments.add(ab);
> }

I know this is how the add method should work then, but the problem is that
I have a "generic" structure. So what I would need is either:

public void add(String listname, Bean bean) {

but I prefer to do the adding directly to the list, so I don't have to
duplicate the name of the list. I already wrote my own version of
insert-bean to be able to have my "appointmentbean" created by a

> When reading
> > What I want to do is add the new appointmentBean to the 
> list of appointments, not to the root (i.e. masterBean).
> I fear this is not exactly what you want, but I don't see 
> another way. 
> Where shall the method be placed in your ideal understanding?

It feels awkward to build my add method with a listname parameter, because
that is already the either the parent context of the repeater widgets or the
rowpath, but I have no idea how to get to that list, either in the add
method as described above, or in the InsertMyBeanBinding I wrote myself. So
if you can tell me how I can figure that out, it's ok too.

Finally, I think it's a bit strange that I cannot have a list as the parent
context of a repeater. I.e.

<fb:context xmlns:fb="" path="/">
  <fb:repeater id="appointments" parent-path="."

In this case on-load works correctly and my existing appointmentBeans are
filled in the repeater rows. However, my insert-bean works on the root (i.e.
/) object, which is not what I want.

<fb:context xmlns:fb="" path="/">
  <fb:repeater id="appointments" parent-path="lists/appointments"

In this case, on-save works correctly (i.e. List.add(myBean) using my
insertMyBeanBinding), but no existing bean is shown in the repeater rows
(there are no rows).

The last version looks much more logical to me.

Bye, Helma

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

View raw message