myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jozef Dropco <jozef.dro...@gmail.com>
Subject Enums in selectItems
Date Sat, 01 May 2010 19:13:54 GMT
Hi all,
I have a little bit stupid question. I got this message: End of weekend: 
'Tuesday' must be convertible to an enum from the enum that contains the 
constant 'Tuesday'. Do I have to write my own converter or what should I 
do.

public enum DayOfWeek {

    MONDAY("Monday"),
    TUESDAY("Tuesday"),
    WEDNESDAY("Wednesday"),
    THURSDAY("Thursday"),
    FRIDAY("Friday"),
    SATURDAY("Saturday"),
    SUNDAY("Sunday");
    private String name;
}

***BEAN***
for (DayOfWeek day :DayOfWeek.values()){
       days.add(new SelectItem(day, day.getName()));
       }
***XHTML***
<tr:selectOneChoice required="true" label="End of weekend" 
value="#{addWeekendDiscount.weekend.endWeekend}">
<f:selectItems value="#{addWeekendDiscount.days}"/>
</tr:selectOneChoice>


Thanks Jozef.

Mime
View raw message