Nikel Weis
Nikel Weis

Reputation: 724

Nested ui:fragment does not accept second rendered attribute

In a template file I've a nested ui:fragment statement:

    <ui:fragment rendered="#{helperBean.isAdministrationPage()}">
        <p:layoutUnit position="west" size="100" resizable="true"
            closable="false" collapsible="true" effect="drop"
            id="west-navigation">
            <h:form>
                <p:panelMenu>
                    <ui:fragment rendered="#{roleCheckerBean.isUserSalesPerson()}">
                        <p:submenu label="Benutzerverwaltung">
                            <p:menuitem value="Registrierungsanträge"
                                url="#{ivy.html.startref('14560484B827F5F3/startAdministrationPageRegistration.ivp')}" />
                        </p:submenu>
                    </ui:fragment>
                </p:panelMenu>
            </h:form>
        </p:layoutUnit>
    </ui:fragment>

The submenu-element should only be rendered if the user has a certain role. The roleCheckerBean is working (I've exchanged isAdministrationPage() and isUserSalesPerson() with the desired result) but the code above does not render the submenu-entry even if the user has a certain role.

Is it not possible to nest ui:fragment statements or am I missing a point here somewhere?

Upvotes: 1

Views: 766

Answers (1)

Michi
Michi

Reputation: 1595

One problem might be, that p:panelMenu only adds p:submenu if it is a direct child in the component tree (just a guess, I did not check this). Using ui:fragment puts a component in between p:panelMenu and p:submenu in the component tree of the page.

You might try to directly use the rendered attribute of p:submenu (it should have one).

Upvotes: 2

Related Questions