Announcement Announcement Module
Collapse
No announcement yet.
Spring Web Bind only Time HH:mm Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Web Bind only Time HH:mm

    Hi,

    I would like to bind only Time HH:mm in MVC. Need to send HH:mm from UI to controller.

    I've entity with java.sql.Time as a variable for startTime.

    While I pass from UI 11:40 as a value it's not binding to the Object in controller.

    Any help appreciated.

  • #2
    For starters ditch the usage of java.sql.Time you want to walk around those classes at least 10 miles... Either use a normal java.util.Date (java.sql.Time extends java.util.Date ?!)... Or use the joda time library (and use a LocalTime object).

    Next you need a DateEditor for databinding and convert your string into a valid date time... I suggest a read of the reference guide on how to configure editors/converters to do conversion.

    Comment


    • #3
      Thanks Marten.

      I've changed it to java.util.Date and used Binder with time format. It worked.

      Thanks.

      Comment

      Working...
      X