Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

f:convertDateTime with h:selectOneMenu

843842Dec 7 2004 — edited Dec 5 2007
I'm having a strange problem trying to use f:convertDateTime with h:selectOneMenu. I assume it should be possible since h:selectOneMenu does have a converter attribute.

Here's my JSP fragment:

<h:selectOneMenu value="#{searchHandler.startDate}" >
<f:convertDateTime type="date" dateStyle="full"/>
<f:selectItems value="#{searchHandler.allQueryDates}" />
</h:selectOneMenu>

My getAllQueryDates() method returns a list of SelectItem objects created like this:

new SelectItem(date, df.format(date));

I've done this so that each date in the select component is displayed in the appropriate locale. I really don't CARE what the date format is for the actual value of the option...I'm expecting JSF to convert it to a date for me. I have:

public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
System.out.println("set start date:" + startDate);
this.startDate = startDate;
}

...but setStartDate() never gets called. I don't get any sort of error, which is frustrating, but it's clearly not doing what I expect.

Am I missing something? Is this simply not supported with h:selectOneMenu?

I'm going to try using longs instead of Dates, which will be fine if it works...but I want to understand why this doesn't work as I'd expect.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 2 2008
Added on Dec 7 2004
6 comments
406 views