File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Composite Component: SelectOneMenu (enum) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Composite Component: SelectOneMenu (enum)" Watch "Composite Component: SelectOneMenu (enum)" New topic

Composite Component: SelectOneMenu (enum)

Marco Noronha
Ranch Hand

Joined: Oct 30, 2012
Posts: 50

I´m trying to create a simple composite component with a selectOneMenu... It is really simple:

So, the problem is when I´m trying to pass the converter! That is an ENUM converter (extends EnumConverter with @FacesConverter(value = "tipoCampoConverter") annotation)

The error is: javax.el.ELException: Cannot convert tipoCampoConverter of type class java.lang.String to interface javax.faces.convert.Converter
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16473

If #{cc.attrs.listValue} is attached to an enum property, it will fail because "selectItems" requires a collection (List or array) of SelectItem, not a single enum, You would have to construct a SelectItem list with a SelectItem entry for each of the enum values that are selectable for this control.

Customer surveys are for companies who didn't pay proper attention to begin with.
It is sorta covered in the JavaRanch Style Guide.
subject: Composite Component: SelectOneMenu (enum)