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 !!");

}

}>

[2145 byte] By [bartdta] at [2007-11-26 17:44:35]
# 1

Ok, solved this one...

Appearently , it had smt to do how I get my destinations !!

Changed it to :

public class SetupBean extends BaseBean{

private Setup setup;

private Collection<SelectItem> destinations = new ArrayList<SelectItem>();;

private Integer destination = new Integer(0);

public SetupBean(){

log.info("Setting the setup and destinations to bean !");

//getSetup();

//getDestinations();

setup = ManagerHelper.setupManager().getSetup(Constants.config2use);

setDestinationsList(ManagerHelper.setupManager().getDestinations());

}

private void setDestinationsList(List destList) {

for(int i =0;i<destList.size();i++){

Destination dest = (Destination) destList.get(i);

destinations.add(new SelectItem(i,dest.getName()));

}

destination=new Integer(1);

}

public void navigateFromMenu(ActionEvent event) {

String current = event.getComponent().getId();

log.debug("The current one is " + current );

}

public Setup getSetup() {

log.info("Getting the setup");

return setup;

}

public void setSetup(Setup setup) {

log.info("Setting the setup ");

this.setup = setup;

}

public Collection getDestinations(){

log.info("Getting the destinations !");

return destinations;

}

public void setDestinations(Collection destinations) {

log.info("Setting the destinations !");

this.destinations = destinations;

}

public void test(){

System.out.println("Entering the test method now !!");

}

public Integer getDestination() {

return destination;

}

public void setDestination(Integer destination) {

this.destination = destination;

}

}>

bartdta at 2007-7-9 0:12:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...