Search code examples
javajsffacelets

Dynamic ui:include inside ui:repeat. Is there a simple solution?


I want to dynamically pick a facelet to render some item in my data list. The first try would be:

<ui:repeat value="#{panels}" var="panel">
  <ui:include src="#{panel.facelet}">
</ui:repeat>

But it won't work since src of ui:include is evaluated too early. The facelet information is truly dynamic, so I cannot use c:forEach (not really recommended to mix with facelets either). I guess it all boils down to finding a component based ui:include alternative.

Is there such thing or I need to write my own?


Solution

  • c:forEach will solve it, why can't you use it?

    Interesting article regarding that issue: https://rogerkeays.com/jsf-c-foreach-vs-ui-repeat