2

I'm using JSF 2.0.

Is there a way to make this code work?

<ui:repeat value="#{theBean.tabList}" var="tab">
    <h:panelGroup rendered="#{theBean.chose == tab.tabHash}">
        <h:outputText value="TESTING #{tab.tabName} (#{tab.tabFile})" />
        <ui:include src="#{tab.tabFile}" />
    </h:panelGroup>
</ui:repeat>

Specifically, the line <ui:include src="#{tab.tabFile}" />. Currently I get a blank page (Meaning, I guess, that #{tab.tabFile} evaluated to null\empty.)

Thanks!

Ben
  • 10,020
  • 21
  • 94
  • 157

1 Answers1

6

The <ui:include> runs during view build time (to generate the JSF component tree) while the <ui:repeat> runs during view render time (to generate the HTML output), which is after the view build time. Use <c:forEach> instead of <ui:repeat>, it runs during view build time as well.

See also:

Roger Keays
  • 3,117
  • 1
  • 31
  • 23
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • since c:forEach works during the view build time how is the value for iterable referenced by EL expression available as that should be available atleast after Apply Request Values Phase ?! – Rajat Gupta Dec 02 '12 at 19:21
  • @user01: I'm not sure if I understand your confusion. The restore view phase (the view build time) runs just before apply request values phase. – BalusC Dec 03 '12 at 00:44