I was able to solve the problem by creating a converter. I made it so that Converter.getAsString() returns a String that is the Enum class name followed by a ":" followed by the enum value. Then, when it does a Converter.getAsObject(), it parses the String, creates an instance of the Class, and calls Enum.valueOf() to get the Enum value. I'm guessing that at some point JSF will have something like this by default? The only thing about it is that the converter is only intended to be used with something like h:selectOneRadio or h:selectOneMenu. i.e. the values are pretty ugly and it's not exactly what you would want to appear in a text box.

Jon

----- Original Message ----- From: "Jonathan Eric Miller" <[EMAIL PROTECTED]>
To: "MyFaces User List" <[email protected]>
Sent: Wednesday, April 13, 2005 4:49 PM
Subject: OT: Possible to use Java 5 enum with h:selectOneRadio?


Does anyone know if it's possible to use a Java 5 type-safe enum with h:selectOneRadio? On first try I'm receiving an error of "Conversion Error setting value 'ISDN' for 'null Converter'." when using the JSF RI. I'm guessing that I would need to create custom converter?

Jon

Attachment: EnumConverterTag.java
Description: Binary data


Attachment: EnumConverter.java
Description: Binary data

Reply via email to