Do ViewScope beans allow ajax calls?
For example:
Here is a xhtml page:
<h:body>
<h:selectOneMenu value="#{test.selected}">
<f:selectItem itemValue="2" itemLabel="2" />
<f:selectItem itemValue="3" itemLabel="3" />
<f:ajax listener="#{test.updateData()}" />
</h:selectOneMenu>
</h:body>
Here is the ViewScoped Bean:
@ViewScoped
@Named
public class test implements Serializable{
private String selected;
public void updateData(){
System.out.println("Ajax call successful.");
}
public String getSelected() {
return selected;
}
public void setTest(String test) {
this.selected = selected;
}
}
When I tried this, it didn't work.