I have a class that has two attributes, start time and end time, both of type Date.
@Temporal(TemporalType.TIME)
private Date horarioInicio;
@Temporal(TemporalType.TIME)
private Date horarioFinal;
In the view layer the Spring Data Binding feature is being used, but when I submit the form with the data, I have the 400 status code as a return, indicating that there is a problem with the request. When both fields are removed, the form is submitted normally. Remembering that the command object is already part of the view.
<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>
<div class="form-group col-md-2">
<form:label path="horarioFinal">Horario final</form:label>
<form:input id="horarioFinal" path="horarioFinal" class="form-control input-sm" type="time" />
</div>
Controller
@RequestMapping("/salvarManutencao")
public String saveFornecedor(@ModelAttribute("manutencao") Manutencao manutencao,
@ModelAttribute("produtosManutencao") HashMap<Long, Long> produtosManutencao, BindingResult bindingResult) {
if (bindingResult.hasErrors())
return "/manutencao/save/saveManutencao";
manutencaoService.saveManutencao(manutencao, produtosManutencao);
return "redirect:fornecedores";
}
Both attributes are part of the Maintenance class.
Has anyone ever had anything similar?