Hello,
My screen generated dynamically contains two combo boxes "Country" and "City". Once you select a country the City combo box should change to show only the cities inside the chosen country.
I have to use Richfaces 3.1.6 (JSF 1.1) because I have OC4J.
The following block from my web page:
<a4j:form ajaxSubmit="true" >
<rich:panel>
<h:panelGrid binding="#{MyBean.htmlPanelGrid}" />
</rich:panel>
</a4j:form>
The following my bean code:
public class MyBean {
private HtmlPanelGrid htmlPanelGrid;
private HtmlSelectOneMenu country;
private HtmlSelectOneMenu city;
// Normal setter/getter
// Constructor
public MyBean() {
htmlPanelGrid = new HtmlPanelGrid();
country = new HtmlSelectOneMenu();
country.getChildren().add(createSelectItem("Jordan", "Jordan"));
country.getChildren().add(createSelectItem("Egypt", "Egypt"));
city = new HtmlSelectOneMenu();
city.getChildren().add(createSelectItem("Amman", "Amman"));
city.getChildren().add(createSelectItem("Cairo", "Cairo"));
HtmlAjaxSupport htmlAjaxSupport = new HtmlAjaxSupport();
htmlAjaxSupport.setEvent("onchange");
htmlAjaxSupport.setReRender("city");
htmlAjaxSupport.setActionListener(
FacesContext.getCurrentInstance()
.getApplication().createMethodBinding
("#MyBean.loadCombo}", null));
country.getFacets().put("ajaxSupport", htmlAjaxSupport);
this.getHtmlPanelGrid().getChildren().add(country);
this.getHtmlPanelGrid().getChildren().add(city);
}
public void loadCombo() {
System.out.println("i am working...");
}
There is no errors, but the loadCombo() method is not called by the AjaxSupport?