Hi,

Hmm, could be. I guess this code was introduced in JSF 1.1 (no unified EL
and thus no EL coercion available) and never changed in later versions.

If you can make the scenario work using EL coercion, please file an issue in
the JIRA. Thanks!

Regards,
Jakob

2010/8/27 Martin Koci <martin.k...@aura.cz>

> Hi,
>
>
> I understand that requirement but isn't it EL coercion task ? :
>
> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=152
>
> and from UISelectMany.validateValue JavaDoc:
>
> " ...Before comparing each option, coerce the option value type to the
> type of this component's value following the Expression Language
> coercion rules ..."
>
>
> Regards,
>
> Martin Kočí
>
> Jakob Korherr píše v Pá 27. 08. 2010 v 15:31 +0200:
> > Hi Martin,
> >
> > The purpose of this conversion is that the value of the SelectItems
> > may be a String, but the real (already converted) value of the
> > UISelectMany may be something else, e.g. Float. Imagine the following
> > scenario:
> >
> > <h:selectManyCheckbox value="#{myBean.inputFloatArray}">
> >             <f:selectItem itemValue="1.1" />
> >             <f:selectItem itemValue="1.2" />
> >             <f:selectItem itemValue="1.3" />
> > </h:selectManyCheckbox>
> >
> > The itemValues of all SelectItems are Strings, but the UISelectMany
> > points to a property which is of type Float[]. Now because of the fact
> > that all Strings can be converted into Floats, this scenario must
> > work.
> >
> > If you now take a look at _SelectItemsUtil.matchValue(), you can see
> > that not the component's value, but the value of the SelectItem is
> > converted via the _ValueConverter:
> >
> > SelectItem item = selectItemsIter.next();
> > Object itemValue = item.getValue();
> > if(converter != null && itemValue instanceof String)
> > {
> >     itemValue = converter.getConvertedValue(context,
> > (String)itemValue);
> > }
> >
> > and then matched against the real value (again which is e.g. Float):
> >
> > if (value==itemValue || value.equals(itemValue))
> > {
> >     return true;
> > }
> >
> > Furthermore the converter has to be invoked with the wrapped String in
> > a String[], because UISelectMany.getConvertedValue() needs a
> > submittedValue of type String[].
> >
> > Is this clear for you or should I explain it in more detail?
> >
> > Regards,
> > Jakob
> >
> > 2010/8/27 Martin Koci <martin.k...@aura.cz>
> >         Hi,
> >
> >
> >         what is the purpose of _SelectItemsUtil._ValueConverter in
> >         UISelectMany.validateValue(FacesContext, Object) ?
> >
> >         Two weird things:
> >
> >         1) it wraps value into new String[] { value }
> >         2) it calls UISelectMany.this.getConvertedValue and it leads
> >         to
> >         Rendered.getConvertedValue call
> >
> >         I don't see sence in  call of
> >         UISelectMany.this.getConvertedValue
> >         because this already done: we are in method validateValue here
> >         and
> >         conversion with Renderer.getConvertedValue is done already.
> >         This causes
> >         calls to Renderer.getConvertedValue during process validation
> >         which is
> >         unintented I think.
> >
> >
> >         Regards,
> >
> >         Martin Kočí
> >
> >
> >
> >
> >
> > --
> > Jakob Korherr
> >
> > blog: http://www.jakobk.com
> > twitter: http://twitter.com/jakobkorherr
> > work: http://www.irian.at
>
>
>


-- 
Jakob Korherr

blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work: http://www.irian.at

Reply via email to