The selectOneMenu seems that doesn't keep track the selection of the user
I retried with the getter of selectedCategory as java.lang.Integer. Now JSF returns as a selection
an unknown object !!! (I checked it with Netbean's debugger) with value null
Can anyone help me with this problem ? It is very important for me to solve it
Kostas Karadamoglou wrote:
Hi again!
I have a problem with SelectOneMenu, JSF does not set the current selection of the user.
this is the jsf tags that I use:
<h:selectOneMenu id="selectCategory" value="#{eventHandler.selectedCategory}">
<f:selectItems id="allCategories" value="#{eventHandler.allCategories}"/>
</h:selectOneMenu>
the allCategories returns a list of selectItems which contain java.lang.Integer as object. The
selectedCategory is of type int.
While I was debugging the application I 've noticed that JSF does not invoke the setter of
selectedCategory.
Do you know how canI solve this problem?
Below I have the getter for each property in the above jsf tags:
public int getSelectedCategory() { return selectedCategory; }
public void setSelectedCategory(int selectedCategory) { this.selectedCategory = selectedCategory; }
public List getAllCategories(){
if(this.allCategories==null){
this.allCategories=new ArrayList();
this.allCategories.add(new SelectItem(converter.getAsInteger(new Category()),"Choose a category..."));
List categories=this.eventRegistry.getCategories();
for(Iterator iter=categories.iterator(); iter.hasNext();){
Category category=(Category)iter.next();
this.allCategories.add(new SelectItem(converter.getAsInteger(category), category.getTitle()));
}
}
return this.allCategories;
}

