In the page, user can input a double value with 2 text input fields. For example, user can input 3 in the first input field and 15 in the second input field, and the result will be 3.15.
However, if the user input 'a' in the first input field and 'b' in the second input, Spring will generate 2 typeMismatch error codes and will display 2 error messages in the page.
Unfortunately, customer only want one error message displayed for the whole value.
And I cannot remove the error code from Errors or BindException since Spring doesn't provide such API. :cry:
One solution is to define the 2 properties as String in the form object, and provide customized validator. But I don't like this solution since the 2 fields are surely integers in the domain.


Reply With Quote