I have a simple struts2 from:
<s:form ...>
<s:textfield name="initialTime" maxlength="5" size="5" />
</s:form>
Where the user has to enter a time in HH:mm format. In the corresponding Action, I have a property:
private Date initialTime;
along with its getter/setter.
I am getting a validation problem, as the received initialTime (i.e. 10:20) is not understood as a valid Date.
What is the good approach to retrieve times ? Should I use a private String initialTime
field instead of a Date
?
Thanks.