Home JSF + Composite + Facet + Composition + Method Parameter = NULL
Reply: 0

JSF + Composite + Facet + Composition + Method Parameter = NULL

user3116
1#
user3116 Published in May 23, 2018, 6:39 pm

I'm trying to develop a pretty complex composite + composition scenario and I'm stuck on a (supposedly) simple issue.

1) Composite component

    <composite:implementation>
        <p:dataTable id="#{cc.attrs.id}"
            tableStyleClass="table-light #{cc.attrs.tableStyleClass}"
            value="#{cc.attrs.value}" scrollable="#{cc.attrs.scrollable}"
            scrollHeight="{cc.attrs.scrollHeight}" rowHover="true"
            paginatorPosition="#{empty cc.attrs.paginatorPosition ? 'bottom' : cc.attrs.paginatorPosition}"
            paginator="#{empty paginator ? 'true' : cc.attrs.paginator}"
            var="tvar" rows="#{empty cc.attrs.rows ? '10' : cc.attrs.rows}">
            <composite:insertChildren />
            <btc:tableColumnAction>
                <composite:renderFacet name="actions" />
            </btc:tableColumnAction>
        </p:dataTable>
    </composite:implementation>

2) Template that uses composite:

    <bt:dataTable value="#{competencyBean.competencies}"
        scrollable="false">
        <p:column headerText="Name">
            <h:outputText value="#{tvar.name}" />
        </p:column>
        <p:column headerText="Locale" width="90">
            <h:outputText value="#{tvar.locale}" />
        </p:column>

        <p:column headerText="Category">
            <h:outputText value="#{tvar.category.name}" />
        </p:column>
        <p:column headerText="Linked To">
            <h:outputText value="#{tvar.defaultLocale.name}" />
        </p:column>

        <f:facet name="actions">
            <ui:insert name="action" />
        </f:facet>
    </bt:dataTable>

3) Composition that extends #2 and defines "action"

    <ui:composition template="/templates/competency/search.xhtml">
        <ui:define name="toolbar">
            <bt:buttonToolbar id="btnNewCompetency" update="@form"
                immediate="true"
                actionListener="#{competencyBean.doNewCompetency()}"
                iTooltip="newCompetency" faIcon="fa-plus" resetTarget="@form">
            </bt:buttonToolbar>
        </ui:define>
        <ui:define name="action">
            <bt:buttonOpen openAction="#{competencyBean.doOpenCompetency(tvar)}" />
        </ui:define>
    </ui:composition>

Finally, it is the result:

Please note:

1) (#1) exports "tvar" as constant to "var" attribute

2) Variable tvar is rendered correctly in table, please see picture above (#2)

It would be perfect but "tvar" is NULL when it is passed as parameter to {competencyBean.doOpenCompetency(tvar)} (#3).

Does anybody can tell me what is wrong?

Edit: I believe there something wrong on f:facet. It seems it doesn't pass variable to method despite it outputs values correctly outside facet.

Thank you.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.41789 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO