[jsr-314-open-mirror] [jsr-314-open] f:selectItems value="#{myMap}" underspecified

Leonardo Uribe lu4242 at gmail.com
Mon Mar 29 22:18:17 EDT 2010


2010/3/29 Martin Marinschek <mmarinschek at apache.org>

> Hi Leonardo,
>
> > Map - The keys of this object (once converted to Strings) are assumed to
> be
> > labels, and the values of this object (once converted to Strings) are
> > assumed to
> > be values, of SelectItem instances that will be constructed dynamically
> and
> > added to the set of available options for the parent component, in the
> order
> > provided by an iterator over the keys.
>
> I never understood why the labels should be the key here - it should
> really be the other way round, and the value should be the key. I
> thought that was sorted for 1.2 - it is not?
>
>
No, this was not solved because the documentation of f:selectItems does
not have the properties mentioned (var, itemValue, itemLabel....). In fact
it was f:selectItem the component that has them in jsf 1.2


> > This behavior comes from jsf 1.1, but in jsf 2.0 it was added some new
> > attributes (from f:selectItems tlddoc):
> >
> > Version 2 of the specification introduces several new attributes,
> described
> > below. These are: var, itemValue, itemLabel, itemDescription,
> itemDisabled,
> > and
> > itemLabelEscaped.
> >
> > Now, what happen if some user do something like this:
> >
> > <f:selectItems value="#{myMap}" var="item"
> > itemLabel="#{item.value.someLabelProperty}" itemValue="#{item.value}">
> >
> > It just does not work, because there is no clear definition about what
> > should
> > f:selectItems do in this case.
> >
> > The proposal for solve this one is if var property is set and value
> > implements
> > Map interface, use the entry object as var, so the user can choose
> between
> > the
> > key and some attribute on the item value.
>
> I totally agree - +1 from me.
>
> best regards,
>
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20100329/161e9f77/attachment-0002.html 


More information about the jsr-314-open-mirror mailing list