I have a web application written in Spring. There is an HTML form with one Integer field. I added a custom post for typeMismatch.java.lang.Integer and it handled correctly, but there is one problem. Spring does not distinguish between string value and overflowed integer. In other words, it makes no difference whether the user enters this is a string or 1000000000000000000000000000 . Both are treated by Spring as typeMismatch . I would like to have two separate posts for both cases.
I thought of two solutions:
- replace
java.lang.Integer with java.math.BigInteger in form - then the typeMismatch error will only apply to this is a string , and I will process 1000000000000000000000000000 into the validator - register your own property editor for
Integer , but I'm not sure that I can handle two different errors with the same property editor
Do you have any better concepts for this problem?
source share