I have the following Managed Bean:
import javax.faces.bean.ManagedBean;
@ManagedBean
public class MyBean {
public void mostrarCentroSeleccionado() {
System.out.println("Value changed");
}
}
And inside my .xhtml file the following selectOneMenu:
<p:selectOneMenu value="#{MyBean.centros.idcentro}" >
<p:ajax event="change" listener="#{MyBean.mostrarCentroSeleccionado}" />
<f:selectItem itemLabel="Seleccione un centro" itemValue="" />
<f:selectItems value="#{MyBean.centros}" />
</p:selectOneMenu>
When I run that code I get the following exception:
javax.el.MethodNotFoundException
Thanks in advance
The problem was in the tag:
<p:ajax listener="#{MyBean.function()}"/>
The function must have "()" becouse I´m not taking the event.