1

How to display a custom message or remove input for integer field in jsp form when user enters white-space in input-field in spring mvc, validated using hibernate validator? It currently shows:

Failed to convert property value of type java.lang.String to required type int for property freePasses; nested exception is java.lang.NumberFormatException: For input string: ""

1 Answers1

1

Use wrapper class to declare integer variables so that wrapper class will convert whitespace to null.

or

refer below link for common solution

Hibernate validation annotation - validate that at least one field is not null

Sumesh TG
  • 2,557
  • 2
  • 15
  • 29