Hi all,

just a question about using SelectItems and converter. 


I have the following code:

<h:selectOneMenu id="levelFilter" value="#{commands.levelFilter}"
valueChangeListener="#{commands.filter}" onchange="submit()"
converter="levelConverter">
        <f:selectItems value="#{commands.levelList}" />
</h:selectOneMenu>


and in my Bean:

public List<SelectItem> getLevelList() {
        
        List<SelectItem> levelList = new LinkedList();
                
        for(int i = 0; i <= level; i++) {
                levelList.add(new SelectItem(i));
        }
        
        return levelList;
}


So far it looks good, but on client side i get:

<option value="Level 1" selected="selected">0</option>
<option value="Level 2" selected="selected">1</option>
....

Instead of expected

<option value="0" selected="selected">Level 1</option>
<option value="1">Level 2</option>
....



Any idea to get the options name and value get turned around?

Regards Oliver

Reply via email to