Thanks Simon for your revised feedback.

I still feel that making a managed-bean call in an iterator still satisfies separation of view from model. I think its an issue of how JSF builds components and how it uses a value derived in an iterator, or I have not understood that well yet.

In any case, I managed to resolve my issue a bit differently. Here is how, for those who may access this thread later on.

This was the original scenario, where the inner call to #{officeBean.offices} would not take iterated value #{customer.id} from #{customerBean.customers}

<ui:repeat var="customer" value="#{customerBean.customers}" >
 Customer: #{customer.id} - #{customer.name} -
  <ui:repeat var="office" value="#{officeBean.offices}">
      Office: #{office.id}
  </ui:repeat>
</ui:repeat>

So, on my 'customerBean' I added another method called #{customerBean.officesByCustomers} which loads all offices for the customers returned by #{customerBean.customers}, and returns a map, with key as customer and values as a list of offices.

And, in the pseudo-code repeater I used it like this:

<ui:repeat var="customer" value="#{customerBean.customers}" >
 Customer: #{customer.id} - #{customer.name} -
<ui:repeat var="office" value="#{customerBean.officesByCustomers[customer.id]}">
      Office: #{office.id}
  </ui:repeat>
</ui:repeat>

Works as expected.
The drawback is that customerBean is pretty loaded up, but I guess that guarantees the complete separation of view from service.

NOTE: this message is getting rejected by myfaces email server.. so I'm not attaching any response form previous threads in this email ..

Thanks
MRather

Reply via email to