Mam hibernacji podmiot i Fasola:wiosna MVC format daty z formularza: wejście
@Entity
public class GeneralObservation {
@DateTimeFormat(pattern = "dd/MM/yyyy")
Date date;
@Column
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
też mam
@InitBinder
protected void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
binder.registerCustomEditor(Date.class, new CustomDateEditor(
dateFormat, false));
}
i
form:input
id = "datepicker"
name="date"
itemLabel="date"
path="newObservation.date"
Kiedy idę do mojego url Rozumiem:
Jak mogę wymusić na nim format mm/DD/rrrr? Niż
'@DateTimeFormat (wzór =„dd/MM/rrrr ")' i 'new SimpleDateFormat (" dd/MM/rrrr ")' oba używają 'dd/MM/rrrr'. Czy próbowałeś je zmienić na' mm/DD/rrrr'? –
przeczytaj http: //stackoverflow.com/questions/3457134/how-to-display-a-formatowany-datetime-in-spring-mvc-3-0 – Algorithmist
Nie, to nie pomogłoby, ponieważ forma: input nie pozwala umieścić wartość domyślna jawnie: –