I have the following field in the form
<div class="form-group col-md-2">
<form:label path="horarioInicio">Horario inicio</form:label>
<form:input id="horarioInicio" path="horarioInicio"
class="form-control input-sm" type="time" />
</div>
In the template class I have the StartTime attribute
@DateTimeFormat(pattern = "HH:mm")
@Temporal(TemporalType.TIME)
private Date horarioInicio;
The problem occurs when I try to submit the form. I always get the following message:
Field error in object 'ordemServico' on field 'horarioInicio': rejected value [00:00]; codes [typeMismatch.ordemServico.horarioInicio,typeMismatch.horarioInicio,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [ordemServico.horarioInicio,horarioInicio]; arguments []; default message [horarioInicio]]; default message [Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for property 'horarioInicio'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.format.annotation.DateTimeFormat @javax.persistence.Temporal java.util.Date] for value '00:00'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [00:00]
Has anyone ever had a similar problem?