I'm having issues with JSR 303 validation when the user does not enter anything in a box. I want to validate that a field must be a number and > 0. Here is the code
@Min(value = 1)
private float price;
If a number is entered the validation works fine but if left empty throws NumberFormatException
I know that I can change float
to Float
and use @NotEmpty
but I don't want to change the type just because of this simple validation.
Any ideas?