myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From monkeyden <monkey...@gmail.com>
Subject Re: Converter error
Date Thu, 02 Nov 2006 23:37:08 GMT

Is the valueChangeListener supposed to return a String?  I was under the
impression that it's supposed to return void, like
ValueChangeListener.processValueChange(ValueChangeEvent event).

Why would it be complaining about the component id?

I wasn't quite clear enough in my description.  This particular select box
is expected to contain, and to submit, several items, so the mutator
(setter) will also take an array.  It's a Collection, owned by a user.


Simon Kitching-3 wrote:
> 
> It looks to me like your method "editProfileAction.updateUserLocations" 
> is not returning a string. The complaint about "userLocations" is 
> referring to the component id, not a method name.
> 
> Value should be a binding to a property (ie get/set methods). When 
> rendering, the getter is called and expects a value that matches the 
> "value" property of one of the SelectItem objects from the f:selectItems 
> child.
> When the user selects a different SelectItem from the list, the setter 
> is called, passing the "value" of whatever SelectItem the user chose..
> 
> Regards,
> 
> Simon
> 
> monkeyden wrote:
>> I am getting a converter error when trying to pass an array of
>> SelectItems to
>> a selectManyListbox.  Isn't this component designed to handle an array? 
>> Why
>> would I need a converter?  Note, these are pre-selected items.  That's
>> why
>> the value of the selectManyListbox is the same as <f:selectItems/>
>>
>> JSF:
>> <h:selectManyListbox immediate="true" id="userLocations" 
>>     value="#{editProfileAction.updateUserLocations}"
>>     size="11" styleClass="selectBox"
>>     valueChangeListener="#{editProfileAction.updateUserLocations}">
>>     <f:selectItems value="#{editProfileAction.userLocations}"/>
>> </h:selectManyListbox>
>>
>>
>> Java:
>> private SelectItem[] userLocations;
>> ...
>> public SelectItem[] getUserLocations() {
>>     return userLocations;
>> }
>>
>> public SelectItem[] getUserLocations() {
>>     return userLocations;
>> }
>> ...
>> Result:
>> java.lang.IllegalArgumentException: Value is no String and component
>> alertsSubView:alertsForm:userLocations does not have a Converter
>> 	at
>> org.apache.myfaces.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:544)
>> 	at
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Converter-error-tf2564573.html#a7148749
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message