jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: 1364-MapInUIRepeatUIData

From: Edward Burns <edward.burns_at_oracle.com>
Date: Wed, 25 Feb 2015 15:24:16 -0800

>>>>> On Fri, 20 Feb 2015 01:06:32 +0100, arjan tijms <arjan.tijms_at_gmail.com> said:

AT> Hi,
AT> In addition to supporting Iterable in UIRepeat and UIData as discussed
AT> in the thread 1103-IterableInUIRepeatUIData, Bauke asked for
AT> supporting Map as well, stating that JSTL's c:forEach has supported
AT> that too.

AT> This too should be relatively easy to implement. Passing in a Map
AT> would expose an Entry<Key,Value> as the type of the EL var, so the
AT> code can easily refer to either the key or the value for each Map
AT> entry. I think there's much established knowledge and usage of this
AT> pattern.

So, essentially when you say

<h:dataTable value="#{cart.items}" var="cur">
  <p>#{cur.key} #{cur.value}</p>
</h:dataTable>

with

public class Cart {

  public Map<String, Object> getItems() {}
}

What do we need to say about calling setValue()?

I expect we would need to create MapDataModel and specify its creation
in the UIData javadoc.

AT> I created https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1364
AT> to track this.

AT> I just asked in 1103-IterableInUIRepeatUIData for your opinion about
AT> this, but at second thought a separate thread might make it clearer.
AT> Sorry for that.

Yes, though I want us to be careful about not creating too many
discussion threads. Generally, I like to reserve the right to top-post
to Manfred and I, but because he and I have limited availability to
manage the list, it's probably better to be looser about this so the
group can continue to make progress without Manfred and I.

Ed

-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
|  8 days til DevNexus 2015
| 18 days til JavaLand 2015
| 28 days til CONFESS 2015