I know there's a syntax for maps ([]), but I haven't really made use
of it myself. I also think it'd be hard to use it to get the key.
Maybe the easiest thing to do would be
<t:selectItems value="#{mbean.systemsAvailable.entrySet}" var="mapEntry"
itemValue="#{mapEntry.key}" itemLabel="#{mapEntry.value}" />
where mapEntry is a Map.Entry instance.
On 3/28/07, Pfau, Oliver <[EMAIL PROTECTED]> wrote:
Hi,
how can I use t:selectItems with a Map ?
E. g.:
<t:selectManyMenu value="#{mbean.systemsSelected}">
<t:selectItems value="#{mbean.systemsAvailable}" var="cursystem"
itemValue="#{cursystem.key}" itemLabel="#{cursystem.value}" />
</t:selectManyMenu>
I don't know what I should do with attributes "var", "itemValue" and
"itemLabel" when using a map. Here is the part of the documentation:
An EL expression that specifies the contents of the selection list. The
expression can refer to one of the following:
1. A single SelectItem
2. An array or Collection of SelectItem instances
3. A Map. The contents of the Map are used to create SelectItem
instances, where the SelectItem's label is the map's key value, and the
SelectItem's value is the map's value. When using a map, it is
recommended that an ordered implementation such as java.util.TreeMap is
used.
The value properties of each of the SelectItems must be of the same
basic type as the parent component's value.