Java Mailing List Archive

http://www.junlu.com/

Home » users.myfaces »

use collections with selectManyCheckboxes and JSF 2.1?

Michael Heinen

2012-04-02

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi all,

I have another weird problem during the migration from JSF 1.2 to 2.1.

In my model I use ArrayLists for the value of selectManyCheckboxes.
If a form is now posted StringArrays are received instead of ArrayLists!

After a lot of debugging I stumbled over two new attributes:
collectionType and valueType.
I set collectionType to "java.util.ArrayList" and valueType to
"java.lang.String".
To my surprise this did not help.

Tag usage:
<t:aliasBean
<t:dataList
<t:selectManyCheckbox id="cboxCPsel"
              rendered="#{cpLink.typeSelectManyCheckBox ||
cpLink.typeTree}"
              disabled="#{aliasCodingPanelReadonly ||
cpLink.readOnly}"
             
value="#{MyProxyController.myDocument.attributes[cpLink.name]}"
              var="sItem"
              collectionType="java.util.ArrayList"
              valueType="java.lang.String">
<f:selectItems value="#{MyProxyController.categories[cpLink.name]}"/>
</t:selectManyCheckbox>


Further debugging:
org.apache.myfaces.shared_tomahawk.renderkit._SharedRendererUtils.getConvertedUISelectManyValue
line 133:

Class<?> modelType = expression .getType(facesContext.getELContext());
modelType is now java.lang.Object!

What's going wrong here?
How can I use Collections with selectManyCheckboxes and JSF 2.1?


libs:
tomahawk20-1.1.11.jar
myfaces 2.1.6
richfaces 4.2 Final

Regards,
Michael


©2008 junlu.com - Jax Systems, LLC, U.S.A.