Announcement Announcement Module
Collapse
No announcement yet.
Validation errors on Command Object Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation errors on Command Object

    Hi,

    I have an optional field on my form that represents a money amount.

    I have declared the corresponding Command class to have a BigDecimal to hold this value.

    Spring parses it correctly when the value is given but throws an exception when it is not.

    Code:
    Error code: Failed to convert property value of type [java.lang.String] to required type [java.math.BigDecimal] for property 'maxAmount'; nested exception is java.lang.NumberFormatException: null
    How best to catch this and allow null for the BigDecimal?

    Thanks

    Rakesh

  • #2
    Problem is that "null" translates to an empty string for html input text boxes.

    I suppose you could write your own property editor and register it on initBinder.

    Comment

    Working...
    X