Hi,
i am doing it always via using tomahawks t:selectItems:
<t:selectOneMenu value="#{bean.type}">
<t:selectItems var="enum" value="#{otherBean.enumValues}"
itemLabel="#{enum.name}"
itemValue="#{enum.type}"/>
</t:selectOneMenu>
and the otherBean:
public List getEnumValues()
{
return Arrays.asList(EnumClass.values());
}
Hope this helps,
cheers - Gerald
On 8/7/07, Wolf Benz <[EMAIL PROTECTED]> wrote:
> I just discover there is a class called java.lang.EnumSet.
> Sandeep - have you tried that already?
> -Wolf
>
> On 8/7/07, sandeep gururaj <[EMAIL PROTECTED]> wrote:
> >
> > Well, I haven't been lucky! If it is possible, do let me know so that I
> > can re-factor my code.
> >
> > ~Sandeep
> >
> > -----Original Message-----
> > From: Wolf Benz [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, August 07, 2007 5:40 PM
> > To: MyFaces Discussion
> > Subject: SelectOneMenu & Enums in "items" var possible?
> >
> > Hi List,
> >
> > Does anyone know whether you can load an Enum into a SelectOneMenu's
> > items variable?
> > So smth like:
> > <h:selectOneMenu value="#{jsfBean.beanVar.varOfEnumType}">
> > <f:selectItem itemLabel="#{labels.choose_one}"
> > itemValue="choose_one"/>
> > <f:selectItems value="#{jsfBean.model.EnumClass}" />
> > </h:selectOneMenu>
> >
> > -Wolf
> >
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces