| Author |
Need to display the value from a map as a label in a drop down using <h:selectOneMenu>
|
Achala pra
Greenhorn
Joined: Feb 16, 2011
Posts: 2
|
|
Need to display the value from a map using <h:selectOneMenu>
I am using primefaces 2.2 and have the following issue regarding <h:selectOneMenu>
I have a bean with following data...
public String favCoffee2;
//Generated by Map
private static Map<String,Object> coffee2Value;
static{
coffee2Value = new LinkedHashMap<String,Object>();
coffee2Value.put("Coffee2 - Cream Latte", "Cream Latte"); //label, value
coffee2Value.put("Coffee2 - Extreme Mocha", "Extreme Mocha");
coffee2Value.put("Coffee2 - Buena Vista", "Buena Vista");
}
public Map<String,Object> getFavCoffee2Value() {
return coffee2Value;
}
.............................
.............................
The following is the code in my xhtml file...
Generated by Map :
<h:selectOneMenu value="#{user.favCoffee2}">
<f:selectItems value="#{user.favCoffee2Value}" />
</h:selectOneMenu>
But looks like it always takes the key from the map to display the label in a drop-down.
Is there another way to display the value of a map ?Top Delete postReport this postReply with quoteEdit post
|
 |
 |
|
|
subject: Need to display the value from a map as a label in a drop down using <h:selectOneMenu>
|
|
|