I do not know if there is a resolved question for this. If so, I could not find him.
I am creating a composite component with two SelectOneMenu that fire an event. The fact is that this component works in one jsf, but not in others.
The component is inside three different xhtml. In all of them, the event fires when I change the value of the first SelectOneMenu, but only in one of the xhtml is the value of SelectItem not null. In the rest of them, the resulting value is "null"
UISelectOne oneVoewl = (UISelectOne)event.getSource();
System.out.println("One Voewl > " + oneVoewl.getValue());
Can someone help me and tell me where I am making a mistake?
Thanks in advance!
The code
Bean component support
@FacesComponent(value="letterExample")
public class LetterExample extends UINamingContainer{
public void voewlAjaxListener(AjaxBehaviorEvent event){
UISelectOne oneVoewl = (UISelectOne)event.getSource();
System.out.println("One Voewl > " + oneVoewl.getValue());
}
Composite component (Note: I am using an existing bean for testing)
<cc:interface componentType="letterExample" >
<cc:attribute name="bean" type="es.ccasa.sgnx.business.bean.Direccion" />
</cc:interface>
<cc:implementation>
<p:selectOneMenu id="oneMenuVoewl" value="#{cc.attrs.bean.codigoPais}"
binding="#{cc.uiSelectOneVoewl}" >
<f:selectItem itemLabel="Aaaa" itemValue="a" />
<f:selectItem itemLabel="Eeee" itemValue="e" />
<f:selectItem itemLabel="Iiii" itemValue="i" />
<f:selectItem itemLabel="Oooo" itemValue="o" />
<f:selectItem itemLabel="Uuuu" itemValue="u" />
<p:ajax event="change" listener="#{cc.voewlAjaxListener}" update="consonantWrapper" />
</p:selectOneMenu>
<h:panelGroup id="consonantWrapper" layout="block">
<p:selectOneMenu id="oneMenuConsonant" value="#{cc.attrs.bean.codigoProvincia}"
binding="#{cc.uiSelectOneConsonant}">
<f:selectItem itemLabel="Bbbb" itemValue="b" />
<f:selectItem itemLabel="Cccc" itemValue="c" />
<f:selectItem itemLabel="Dddd" itemValue="d" />
</p:selectOneMenu>
</h:panelGroup>
</cc:implementation>
Bean
public class Direccion implements Serializable {
private String codigoPais;
private String codigoProvincia;
}
XHTML
xhtml-: ( )
<sgnx:letter-example bean="#{controller.direccion}" />
@Named beans
@Named
@ViewScoped
public class P001DatosNotificacionController
private Direccion direccion;
@Named
@ViewScoped
public class P001GestionNotificacionesController
private Direccion direccion;
@Named
@ViewScoped
public class P002BandejaProvisionalNotificacionesController
private Direccion direccion;