So I am working on a project that is setup with ofbiz java framework. It uses xml for design and It seems like when you enforce a field to type number someone can still key in alphabet characters in that field. Java by default has types which means when a user keyed in a alpha in that field i will get PostgreSQL database error example 'hh' is not a Big Decimal. If it was JavaScript I would have done something like typeOf(amount) and if I find its string I just return an error before this proceeds to database for saving which leads to this error below.
I understand that my amount variable is of type BigDecimal but how can I check if the user really keyed in a numeric and not an alpha since my field attribute type='number' isn't working for me.

You can use a try catch block