Combining listbox with button
Hello,
I am quiet new in this JSF domain and I'm currently encountering the following error :
I have a JSP page that contains the following :
<h:selectOneListbox id="destinations" binding="#{setupBean.listbox}">
<f:selectItemsvalue="#{setupBean.destinations}" /></h:selectOneListbox>
<h:commandButton action="#{setupBean.test}" title="Submit" />
Now I want to run the test Method on my setupBean. No problem as long as I don't click on the listbox. Once clicked on the listbox, he never enters the test method !!
Anyone who has any idea ?
This is my setupBean :
public class SetupBean extends BaseBean{
private Setup setup;
private List destinations;
private HtmlSelectOneListbox listbox;
public SetupBean(){
log.debug("Setting the setup and destinations to bean !");
getSetup();
getDestinations();
}
public void navigateFromMenu(ActionEvent event) {
String current = event.getComponent().getId();
log.debug("The current one is " + current );
}
public Setup getSetup() {
setup = ManagerHelper.setupManager().getSetup(Constants.config2use);
return setup;
}
public void setSetup(Setup setup) {
this.setup = setup;
}
public List getDestinations(){
destinations = ManagerHelper.setupManager().getDestinations();
List<SelectItem> destinationAsSelectItems=new ArrayList<SelectItem>();
for(int i=0;i<destinations.size();i++){
Destination dest = (Destination) destinations.get(i);
destinationAsSelectItems.add(new SelectItem(dest.getId(),dest.getName()));
}
return destinationAsSelectItems;
}
public void setDestinations(List destinations) {
this.destinations = destinations;
}
public HtmlSelectOneListbox getListbox() {
return listbox;
}
public void setListbox(HtmlSelectOneListbox listbox) {
this.listbox = listbox;
}
public void test(){
System.out.println("Entering the test method now !!");
}
}>

