I am trying to add ajax for a dropdown and I have added the below code in my xhtml but the listner is not getting called once there is a change.
XHTML Code:
<h:selectOneMenu
value="#{loginBean.dropDownValue}" itemValue="#{dropDownValue}">
<f:selectItem itemValue="****select***" />
<f:selectItems value="#{loginBean.testDropDown}"/>
<f:ajax event="change" listner="#{loginBean.changeDropDownOne}" render="testDropDownTwoValue" />
</h:selectOneMenu>
Method in the bean:
public List<SelectItem> changeDropDownOne() {
System.out.println("$$$$$$$$$$");
String dp = getDropDownValue();
if(dp != null) {
System.out.println("**********************getTestDropDownTwo********************************"+dp);
if(dp.equalsIgnoreCase("One")) {
testDropDownTwo.add(new SelectItem("One - One"));
testDropDownTwo.add(new SelectItem("One - Two"));
testDropDownTwo.add(new SelectItem("One - Three"));
testDropDownTwo.add(new SelectItem("One - Four"));
} else if(dp.equalsIgnoreCase("Two")) {
testDropDownTwo.add(new SelectItem("Two - One"));
testDropDownTwo.add(new SelectItem("Two - Two"));
testDropDownTwo.add(new SelectItem("Two - Three"));
testDropDownTwo.add(new SelectItem("Two - Four"));
}else if(dp.equalsIgnoreCase("Two")) {
testDropDownTwo.add(new SelectItem("Three - One"));
testDropDownTwo.add(new SelectItem("Three - Two"));
testDropDownTwo.add(new SelectItem("Three - Three"));
testDropDownTwo.add(new SelectItem("Three - Four"));
}else {
testDropDownTwo.add(new SelectItem("Four - One"));
testDropDownTwo.add(new SelectItem("Four - Two"));
testDropDownTwo.add(new SelectItem("Four - Three"));
testDropDownTwo.add(new SelectItem("Four - Four"));
}
}
return testDropDownTwo;
}