Using default converter in picklist

UI Components for JSF
Post Reply
theodor.richard
Posts: 25
Joined: 15 Jul 2010, 09:23

28 Jul 2010, 17:25

Hi,

I'd like to use the picklist with complex objects (i.e. not strings) without explicitly specifying a converter. Like this:

Code: Select all

<p:pickList value="#{employeeController.customersDualList}" var="customer"
                            itemLabel="#{customer.companyName}" itemValue="#{customer}" />
I have a CustomerConverter class that is annotated with @FacesConverter(forClass = Customer.class). The annotation registers the converter a default converter for Customer/String conversions. In PrimeFaces, however, when a converter is not specified, it tries to cast the Customer object to a String object throwing the following exception:

Code: Select all

com.test.Customer cannot be cast to java.lang.String
Am I missing something, or are default converters not supported in PrimeFaces?

Thanks,

Theo
PrimeFaces 5.2, PrimeFaces Extensions 3.2, OmniFaces 2.1, Glassfish v4.1, Mojarra 2.2.12

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

28 Jul 2010, 19:15

I've checked the picklist and it turns out it doesn't consider implicit converters. Please create an issue ticket so we can deal with this during picklist enhancements which will introduce skinning, drag drop and ordering.

theodor.richard
Posts: 25
Joined: 15 Jul 2010, 09:23

28 Jul 2010, 20:54

Filed a bug: http://code.google.com/p/primefaces/iss ... il?id=1052

Does this apply only for the picklist, or for all PF components?
PrimeFaces 5.2, PrimeFaces Extensions 3.2, OmniFaces 2.1, Glassfish v4.1, Mojarra 2.2.12

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 43 guests