Spring MVC + Joda Time + @Datetimeformat

Asked

Viewed 332 times

6

Description:

The Spring does not convert using the @DateTimeFormat, try to order the start of the two forms below and it returns to me a 404. When I send the object without this field it creates the normal object, but cannot create when I do the request with the countryside start.


First attempt

`@DateTimeFormat(pattern = "HH:mm")
 @Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalTimeAsString")
 LocalTime start`

Second attempt

`@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalTimeAsString")
 @DateTimeFormat(pattern = "MM/dd/yyyy")
 private DateTime start;`

Spring documentation:

`Use @DateTimeFormat to format
java.util.Date, java.util.Calendar, java.util.Long, or Joda Time fields.`
  • Is Joda Time on Classpath? Which version?

1 answer

1


First thing you need to check is the versions of Jodatime and Spring.

In your entity statement you do not need to declare the @Type annotation, spring has already implemented the @Datetimeformat annotation with direct integration to Jodatime.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.