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

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

Emilio Numazaki
Emilio Numazaki Published in 2018-02-14 04:40:03Z

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

1) Composite component

        <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 />
                <composite:renderFacet name="actions" />

2) Template that uses composite:

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

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

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

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"
                iTooltip="newCompetency" faIcon="fa-plus" resetTarget="@form">
        <ui:define name="action">
            <bt:buttonOpen openAction="#{competencyBean.doOpenCompetency(tvar)}" />

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.308829 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO