We have in our JSF 2.2 project a composite component used like this (the code has been simplified for clarity):
<!-- the page with the composite component inside -->
<my:component methodListener="#{myBean.myMethod}" />
<!-- the composite component -->
<cc:interface>
<cc:attribute name="methodListener" required="true" method-signature="void listener(javax.faces.event.AjaxBehaviorEvent)" />
...
<cc:implementation>
<h:commandLink>
<f:ajax listener="#{cc.attrs.methodListener}" />
<f:attribute name="myAttribute" value="myValue" />
</h:commandLink>
// the called method
public void myMethod(AjaxBehaviorEvent event)
{
System.out.println("> " + event);
}
In Wildfly 9.0.2, when clicking on the commandLink
inside the composite component, myMethod
is called and the event is defined (allowing us to find back myAttribute
value).
In Wildfly 10.1.0, with the exact same code, myMethod
is called but the event parameter is always null
.
Are we doing something wrong here?
A tested workaround could be to replace the methodListener CC attribute with a bean instance, something like the following code. Still, this would require a lot of replacements in our project, therefore we'd like to avoid this solution.
<!-- the workaround composite component -->
<cc:interface>
<cc:attribute name="methodBean" required="true" type="com.example.myBean" />
...
<cc:implementation>
<h:commandLink>
<f:ajax listener="#{cc.attrs.methodBean.myMethod}" />
<f:attribute name="myAttribute" value="myValue" />
</h:commandLink>