I would like to set up a Date field in my page like this
|hours| h |minutes| where hours and minutes are in separated inputText.
The bean have this date
import java.util.Date; ... private Date myDate; ... and the page is
<h:form> ... <h:inputText id="myDateHours" maxlength="2" value="#{myBean.myDate}" <f:convertDateTime pattern="HH" /> </h:inputText> <h:outputText value=" h " /> <h:inputText id="myDateMinutes" maxlength="2" value="#{myBean.myDate}" <f:convertDateTime pattern="mm" /> </h:inputText> ... </h:form> But the problem is that when I submit the form only the last element is saved. For instance if I type the hours and then the minutes, the hours are overwritten and the result is
| 00 | h | minutes | I tried to set
<h:inputText id="myDateHours" value="#{myBean.myDate.hours}></h:inputText> <h:inputText id="myDateMinutes" value="#{myBean.myDate.minutes}></h:inputText> but I get a
Cannot convert 01/01/70 01:00 of type class java.util.Date to int I don't want to replace my date field with two int field (hours and minutes...) Do you have an idea?
Thanks