Results 1 to 3 of 3

Thread: Spring Web Bind only Time HH:mm

  1. #1
    Join Date
    Dec 2010
    Posts
    5

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Dec 2010
    Posts
    5

    Default

    Thanks Marten.

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

    Thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •