I recently moved some code from a view to a composite jsf tag to make my code cleaner, but just realized that an ajax call is no longer working.
The browser makes the update, and I can see the data displaying, but the method just don't get called a all.
I've the following code as a tag:
<composite:interface>
<composite:attribute name="viewBean" type="org.example.view.RegistroMunicipalView" required="true" />
</composite:interface>
<composite:implementation>
<saimTags:dataFlag viewBean="#{cc.attrs.viewBean}"/>
<p:selectOneMenu styleClass="source_select" value="#{cc.attrs.viewBean}" >
<f:selectItems value="#{cc.attrs.viewBean.registros}" var="registro"
itemValue="#{registro.idRegistro}"
itemLabel="#{registro.nombre}"></f:selectItems>
<p:ajax listener="#{cc.attrs.viewBean.registroChanged()}" oncomplete="checkForData()" update="@(.section_content)"/>
</p:selectOneMenu>
</composite:implementation>
This one as the class with the method to be called:
public abstract class RegistroMunicipalView extends MunicipalView {
private Integer idRegistro;
public abstract void registroChanged();
}
And like this the implementation of the tag
<saimTags:displayRegistro viewBean="#{informacionMunicipalView}"/>
Any clue of what could be wrong?
It was caused because of a wrong attribute value in the selectOneMenu, it was pointing to the bean instead of the property idRegistro which caused a silent failure, with this change the method is now called correctly.
Before:
<p:selectOneMenu styleClass="source_select" value="#{cc.attrs.viewBean}" >
After:
<p:selectOneMenu styleClass="source_select" value="#{cc.attrs.viewBean.idRegistro}" >