Podziel java.util.Date na dwa h: pola inputText reprezentujące godzinę i minutę za pomocą f: convertDateTime

Chciałbym ustawić pole daty na mojej stronie w ten sposób

|hours| h |minutes|

gdzie godziny i minuty są w oddzielnym tekście wejściowym.

Fasola ma tę datę

import java.util.Date;
...
private Date myDate;
...

a strona jest

<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>

Ale problem polega na tym, że po przesłaniu formularza zapisywany jest tylko ostatni element. Na przykład, jeśli wpiszę godziny, a następnie minuty, godziny zostaną nadpisane, a wynikiem będzie

| 00 | h | minutes |

Próbowałem ustawić

<h:inputText id="myDateHours" value="#{myBean.myDate.hours}></h:inputText>

<h:inputText id="myDateMinutes" value="#{myBean.myDate.minutes}></h:inputText>

ale dostaję

Cannot convert 01/01/70 01:00 of type class java.util.Date to int

Nie chcę zastępować mojego pola daty dwoma polami int (godziny i minuty ...) Czy masz pomysł?

Dzięki

questionAnswers(2)

yourAnswerToTheQuestion