Typo below: selectItems.put(new Integer(o.ordinal()), o.getName()) should be: selectItems.put(o, o.getName()); In any case, I'm still trying to figure out how to use the EnumConverter with <h:selectOneRadio/> and friends.
[EMAIL PROTECTED] 05/22/2007 02:49 PM Please respond to "MyFaces Discussion" <users@myfaces.apache.org> To "MyFaces Discussion" <users@myfaces.apache.org> cc Subject Re: enumerated type and f:selectItems Thanks! If I understand correctly, this converter is for the variable which is value-bound to a UIOutput/UIInput-derived classes (e.g. UISelectOne), but not for UISelectItems. In other words, is there a way to get <f:selectItems/> to output options for all values of the enumerated type? I tried: <f:selectItems value="{#MyClass.selectItems"/> public Map<MyEnum, String> getSelectItems() { Map<MyEnum, String> selectItems = new EnumMap<MyEnum, String>(MyEnum.class); for (MyEnum o : EnumSet.allOf(MyEnum.class)) selectItems.put(new Integer(o.ordinal()), o.getName()); return selectItems; } and a few variations on that, without any success. "Cagatay Civici" <[EMAIL PROTECTED]> 05/22/2007 01:01 PM Please respond to "MyFaces Discussion" <users@myfaces.apache.org> To "MyFaces Discussion" <users@myfaces.apache.org> cc Subject Re: enumerated type and f:selectItems Hi, Sandbox15 has an enumconverter too. http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/converter/enumeration/EnumConverter.java?view=markup Cagatay On 5/22/07, Andrew Robinson <[EMAIL PROTECTED]> wrote: If you use jboss seam there is support for an enum converter and enum-select item components that do just what you are looking for. On 5/22/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > Hi, > > What's the best way generate UISelectItems from an enumerated type? I'd like > to populate a UISelectOne-based component with enumerated type values and > back the component with an enumerated type variable instance. This seems > like it should be a common pattern in JSF with JDK 1.5+. In fact, I'm a > little surprised we can't specify an enumerated type (or variable of an > enumerated type) for f:selectItems. > > Thanks for any replies, > Eric > > _________________________ > > CONFIDENTIALITY NOTICE > > The information contained in this e-mail message is intended only for the > exclusive use of the individual or entity named above and may contain > information that is privileged, confidential or exempt from disclosure under > applicable law. If the reader of this message is not the intended recipient, > or the employee or agent responsible for delivery of the message to the > intended recipient, you are hereby notified that any dissemination, > distribution or copying of this communication is strictly prohibited. If you > have received this communication in error, please notify the sender > immediately by e-mail and delete the material from any computer. Thank you. > _________________________ CONFIDENTIALITY NOTICE The information contained in this e-mail message is intended only for the exclusive use of the individual or entity named above and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivery of the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by e-mail and delete the material from any computer. Thank you. _________________________ CONFIDENTIALITY NOTICE The information contained in this e-mail message is intended only for the exclusive use of the individual or entity named above and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivery of the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by e-mail and delete the material from any computer. Thank you.