Search code examples
jsf-2faceletsicefaces

facelets insert/define with value binding expression


I try to bind bean property to ui:insert name attribute.

<ice:panelTabSet var="tab" items="#{mainTabsTempl.tabs}">               
    <ice:panelTab label="#{tab.label}">  
        <ui:insert name="#{tab.tabContentUIName}">   
           content of #{tab.tabContentUIName} tab   
        </ui:insert>    
    </ice:panelTab>  
</ice:panelTabSet>

and ui:insert see this value binding expression like a string.

Is there any way to pass value binding expression?


Solution

  • Now I see what you are trying to achieve. Unfortunately it is impossible for at least two reasons. First ui:insert supports literals only. It explicitly checks name attribute and throws an exception when it is not a literal. The second reason is panelTabSet is a component, so its variable - "tab" in your case - is available at rendering phase while ui:insert/ui:define are tag handlers executed during view construction.

    You can try to rephrase your question and ask again. My understanding is you want to have an enriched tabset template/component to which you can pass a series of facets to be used as separate tabs. My guess would be trying composite components and insertFacet with f:facet. I haven't used composite components though so I won't be able to help here.