Real time use of user defined exception in Java
To know the real time use of user defined exception in java!
real time use of user defined exception for example in facebook if we entered age below 15 it gives message like that I want some more real time uses.
The exception can be user defined. You can define any message that you want to show just below the text box.
Also, the rules can be customized. For example, you could have following rules -
- Length of the input
- Minimum and Maximum value (for example, age could be between 18 and 60)
- Whether the input text is a valid email ID
- Whether the input text is a valid phone number
and so on.
There ARE ways to do this using Java on the server side. In that case, you will have to fire AJAX requests to the server in real time and get the response. It's not an efficient method of validating input fields, though.
I hope this helps.