On Sun, 2009-03-15 at 13:28 +0000, Johannes Ruthenberg wrote:
> Hi everyone!
> 
> First, a big thank you to Cagatay! I was about to agree with Simon that 
> f:selectItems couldn't do this (judging from the documentation), but it 
> seems that I didn't even try it without the other attributes. I just 
> tried it out and this actually works like expected (selectedRoles being 
> a Long[] and allRoles a Map<String, Long>):
> 
> <h:selectManyCheckbox id="selectedRoles" value="#{myBean.selectedRoles}">
>   <f:selectItems value="#{myBean.allRoles}"/>
> </h:selectManyCheckbox>
> 
> The same with t:selectItems does not work, even if the documentation 
> states that it should. ;-)

Hmm..interesting.

This behaviour of building a list of SelectItems from a Map is actually
implemented in the SelectItemsIterator class.

(1) I'm not sure that this is standard JSF behaviour, ie I am not sure
that code depending on this will run on any JSF implementation other
than MyFaces.

(2) By adding custom Map handing inside the t:selectItems component,
this prevents the SelectItemsIterator functionality from working. The
SelectItemsIterator class never sees that the "value" is of type Map
because the t:selectItems has already replaced the map with a list of
SelectItems it has built itself.

The situation seems really messy to me, but it's not clear what the best
solution would be. I have created a JIRA issue for this:
 https://issues.apache.org/jira/browse/TOMAHAWK-1403

Thanks for reporting this Johannes, and sorry you struck such an odd
issue shortly after starting with JSF!

Regards,
Simon

Reply via email to