Hi Simon,
the exadel example jar actually runs without any problems and I don't
see any custom converter configured.
I don't know why this is the case, this was the reason for starting this
thread anyway ;)
I modified my classes to handle Strings in the getter and setters and
now it works.
I still would like to know why the exadel example handles
javax.faces.model.SelectItem directly.
Regards,
Kurt
on 12/8/2005 2:36 PM Simon Kitching stated:
Simon Kitching wrote:
Kurt Edegger wrote:
Let me post the carBean class to show that 'carBean.currentCar'
accesses the SelectItem directly [1]:
Hmm..interesting. Thanks for posting that.
However I can't see any Converter class in MyFaces that is capable of
doing String->SelectItem conversion. The Converter methods do get
passed the associated UIComponent, so potentially such a converter
could access its parent component in order to iterate over its child
SelectItem objects.
It must be possible, as the example jar clearly does it. However I
can't figure out *how* the UISelectOneMenu can use a value-binding
dealing in SelectItem instances. I'd be very happy if someone could
explain!
Of course, specifying the "value" binding as a primitive property
(String/int/etc) works fine.
Looking at the official Sun javadoc for the SelectItem class, the
getValue() method is defined as follows:
<quote>
Return the value of this item, to be delivered to the model if this item
is selected by the user.
</quote>
This sure implies that the "value" attribute of the enclosing
<t:selectOneMenu> should point to a property that takes objects of the
same type as is returned by SelectItem.getValue(), rather than taking a
complete SelectItem instance.
The MyFaces examples dir has "selectbox.jsp", whose backing bean is
class CarConfigurator.java. This example always maps the select
component's "value" attribute to primitive properties, eg
public String getCar();
public int getDoors();
Does the exadel example jar actually run?
Cheers,
Simon