0

it's a bit similar to this problem https://issues.jboss.org/browse/RF-11469 I have a template containing a composite defined like this:

<h:form id="transfer_list">
        <ccs:criteriaPanel header="Critère de recherche"
                           filterAction="#{controller.filter()}">
                <form:criteriaForm bean="#{controller.transferCriteria}"
                                   rendered="#{! empty controller.transferSearchForm}"
                                   mode="UPDATE"
                                   controller="#{controller}" />

        </ccs:criteriaPanel>
</h:form>

Controller is defined with a ui:param in the template child.

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    template="/pages/transfer/transferList.xhtml">

    <ui:param name="controller" value="#{transferListOpenController}" />
</ui:composition>

Here is the composite impl (criteriaPanel):

<cc:interface>
    <cc:attribute name="header" default="#{i18n['HEADER_SEARCH_CRITERIA']}" />
    <cc:attribute name="filterAction" method-signature="java.lang.Object filter()" />
    <cc:attribute name="update" default="@(.ui-datatable)" />
</cc:interface>

<cc:implementation>
    <div id="#{cc.clientId}">
        <p:panel header="#{cc.attrs.header}" toggleable="true">
            <cc:insertChildren />

            <f:facet name="footer">
                <p:commandButton id="search_btn"
                                 value="#{i18n['BUTTON_FILTER']}" 
                                 action="#{cc.attrs.filterAction}"
                                 icon="ui-icon-search"
                                 update="#{cc.attrs.update}" />

               <p:commandButton value="#{i18n['BUTTON_CLEAR_FILTER']}"
                                action="#{cc.attrs.filterAction}" 
                                process="@this" 
                                immediate="true"
                                update="#{cc.attrs.update}">
                     <p:ajax update="@form" resetValues="true" /> 
                </p:commandButton>
            </f:facet>

            <p:defaultCommand target="search_btn" />
        </p:panel>
    </div>
</cc:implementation>

Clicking on the button "filterAction" result into this:

javax.faces.FacesException: #{cc.attrs.filterAction}: javax.el.PropertyNotFoundException: Target Unreachable, identifier [controller] resolved to null at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) at org.primefaces.application.DialogActionListener.processAction(DialogActionListener.java:45) at javax.faces.component.UICommand.broadcast(UICommand.java:315)

I use Tomcat 8.5 for this and Mojarra 2.2.13. It works if I don't put the whole thing in a composite component (criteriaPanel)

UPDATE

Sample available here: https://github.com/Rapster/primefaces-test/tree/issue-sof-45834296

Works fine with MyFaces 2.2.11 and Mojarra 2.2.8-23 and 2.3.2 (I don't know how impactful upgrading to 2.3 can be though...) From what I read here https://stackoverflow.com/a/42656386/4605161, Mojarra 2.2.8 is aimed for WebLogic but it seems I will need this one (and i'm running on Tomcat)

WORKAROUND

Writing this make it work (but that's a workaround i'd rather use template):

<ui:composition xmlns="http://www.w3.org/1999/xhtml">

    <ui:param name="controller" value="#{testView}" />

    <ui:decorate template="/template.xhtml">
     </ui:decorate>
</ui:composition>

Funny thing is if I put ui:param inside ui:decorate I'll end up with the same exception

Rapster
  • 484
  • 1
  • 5
  • 23
  • Mojara 2.2.8-xx (note the xx) are for Weblogic, not 2.2.8 in general, you can use the latest 2.2.x instead of 2.2.8-xx – Kukeltje Aug 24 '17 at 08:48
  • I wish, but it's not working with 2.2.14 either... – Rapster Aug 24 '17 at 08:53
  • I see that 2.2.8-23 is newer than 2.2.14, so 2.2.8-23 might contain fixes that are not (yet) in a 2.2.x release (other than maybe the 2.2.13.SP4 which you could try although it seems a JBoss custom release, it might work). But if 2.2.8-23 works for you to (you tried, right?) I would think you can safely use that to. Just keep track of 2.2.x release that might work to and upgrade then. – Kukeltje Aug 24 '17 at 08:59
  • Should be fixed in 2.2.15, see https://github.com/javaserverfaces/mojarra/issues/4271 – Rapster Sep 12 '17 at 08:32
  • Great feedback. You can add a summary of the comments as an answer. – Kukeltje Sep 12 '17 at 08:38

1 Answers1

1

Should be fixed in 2.2.15, see github.com/javaserverfaces/mojarra/issues/4271

Rapster
  • 484
  • 1
  • 5
  • 23