Announcement Announcement Module
Collapse
No announcement yet.
NumberFormatException binding to Number Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NumberFormatException binding to Number

    We are binding a text input field to a property of type Long on our command class. We have a Validator which checks that the user's input is a valid number format, but in the case the user enters non-digit characters, these validations are never reached. Instead, the CustomNumberEditor throws a NumberFormatException and the user gets the following error message in the jsp:

    Code:
    Failed to convert property value of type [java.lang.String] to required type [java.lang.Long] for property 'quantity'; nested exception is java.lang.NumberFormatException: For input string: "dfkjd"
    Is there any way to customize this error message? Thanks.

    -karl

  • #2
    Yes there is, and you can do a lot with it.

    e.g.
    typeMismatch.java.sql.Date=Could not convert date

    see http://www.springframework.org/docs/...sResolver.html

    or search this forum a bit

    Comment


    • #3
      This is a great help. Thx!

      Comment

      Working...
      X