Ben
Ben

Reputation: 10288

dynamic ui:include with el-expression?

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!

Upvotes: 2

Views: 2646

Answers (1)

BalusC
BalusC

Reputation: 1108632

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:

Upvotes: 6

Related Questions