myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Mahoney (JIRA)" <myfaces-...@incubator.apache.org>
Subject [jira] Commented: (MYFACES-583) "Error during model data update" using selectManyCheckbox
Date Mon, 19 Sep 2005 15:57:32 GMT
    [ http://issues.apache.org/jira/browse/MYFACES-583?page=comments#action_12329874 ] 

Peter Mahoney commented on MYFACES-583:
---------------------------------------

Following this patch, the values are submitted successfully, however the checkboxes are always
rendered unchecked - both from submitted and selected values. I shall investigate the encoding
for possible problems.

> "Error during model data update" using selectManyCheckbox
> ---------------------------------------------------------
>
>          Key: MYFACES-583
>          URL: http://issues.apache.org/jira/browse/MYFACES-583
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: Nightly Build
>     Reporter: Peter Mahoney

>
> I have a selectManyCheckBox backed by an Integer array property. When the form is submitted,
I get an exception thrown when updating the model:
> Caused by: javax.servlet.jsp.el.ELException: Attempt to coerce a value of type "[Ljava.lang.Object;"
to type "[Ljava.lang.Integer;"
> It seems that the property is trying to be set with an Object array, rather than Integer
array.
> I have tracked the problem down to _SharedRendererUtils:
> ...
>         {
>             //Object array
>             int len = submittedValue.length;
>             Object[] convertedValues = new Object[len];
>             for (int i = 0; i < len; i++)
>             {
>                 convertedValues[i]
>                     = converter.getAsObject(facesContext, component, submittedValue[i]);
>             }
>             return convertedValues;
>         }
> ..
> Given that we know what type the array should be, a suggested patch for the code is:
>             int len = submittedValue.length;
>             ArrayList convertedValues = new ArrayList(len);
>             for (int i = 0; i < len; i++)
>             {
>                 convertedValues.add(i, converter.getAsObject(facesContext, component,
submittedValue[i]));
>             }
>             
>             return convertedValues.toArray((Object[]) Array.newInstance(arrayComponentType,
len));
> Peter

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message