4

several h:selectManyCheckboxs are backed by this map of type: Map<Type, ArrayList<MyItem>>.

The xhtml snippet looks like this:

<h:selectManyCheckbox
    value="#{backingBean.values['type']}"
    collectionType="java.util.ArrayList"
    converter="#{myCustomConverter}>
    <f:selectItems .../>
</h:selectManyCheckbox>

The checkboxes are display correctly, and the converter is used correctly in both ways.

Unfortunately when I try to access the values of the map after submitting the page, the map does not hold lists anymore. Instead I get a ClassCastException, because the values have been replaced by an Object[].

Searching the internet, I seem to have exactly the same problem as in MyFaces.

I think, I have tracked down the issue to MenuRenderer. The type of the EL expression is determined, which leads to Object in my case. But only if the type is related to Collection in the first place, the attribute collectionType is respected.

I use Mojarra 2.1.0, but even later versions did not change the relevant source code.

Summing up:

  • Do I have the correct expectaction that the List shall remain a List?
  • I this really a bug? If so, has it been fixed in later versions?
  • Is there a workaround?

Thanks a lot in advance.

Regards,

Daniel

DanielK313
  • 41
  • 2

0 Answers0