Real time use of user defined exception in Java
To know the real time use of user defined exception in java!
To know the real time use of user defined exception in java!
Administrator • Aug 29, 2018
#-Link-Snipped-# - Any question that is not properly described is deleted from the site. Please add more information to your question (reply below) so that we can keep the question in the list.Â
Member • Aug 29, 2018
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.
Administrator • Aug 29, 2018
It's not Java, it's JavaScript that's doing all the magic. When user enters an invalid input in the text input box, JavaScript keeps checking it - and if the input is invalid, it will throw an exception.
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 -
and so on.
I'll recommend checking out Parsley JS Validation library. Keep in mind that it's the JavaScript, not the Java that's doing stuff on the front end.
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.