I have a web application wrote in Spring. There is a HTML form with one Integer field. I added a custom message for typeMismatch.java.lang.Integer and it is correctly handled but there is one issue. Spring does not distinguish between a string value and "overflowed" integer. In other words - there is no difference whether user enter this is a string or 1000000000000000000000000000. Both are handled by Spring as typeMismatch. I would like to have two separate messages for both cases.
I thought about two solutions:
- replace the
java.lang.Integerbyjava.math.BigIntegerin the form object - then thetypeMismatcherror will apply only tothis is a stringand I will handle1000000000000000000000000000in a validator - register my own property editor for
Integer, but I'm not sure if I could handle two different errors with one property editor
Do you have any better concepts for this issue?
Aucun commentaire:
Enregistrer un commentaire