Does anybody knows how can component be mapped on a java.util.Calendar field, not java.util.Date?
I am
Either do as BalusC suggests, or simply set value="#{yourBean.yourCalendar.time}.
Wrap the Calendar property with another getter/setter returning/taking a Date.
private Calendar calendar;
public Date getCalendarDate() {
return (calendar != null) ? calendar.getTime() : null;
}
public void setCalendarDate(Date date) {
if (calendar == null) {
calendar = Calendar.getInstance();
calendar.clear(); // Avoid timezone issues.
}
calendar.setTime(date);
}
A JSF converter isn't going to work because this only does Object<-->String conversions, while we need a Object<-->Date conversion here. I don't do IceFaces, but there might be the chance that the particular component accepts a date string in a certain format pattern as well. You would need to find that out and then write the covnerter accordingly to convert Calendar<-->String according this string format pattern. The java.text.SimpleDateFormat is helpful in this.