Real time use of user defined exception in Java

To know the real time use of user defined exception in java! 

Replies

  • Kaustubh Katdare
    Kaustubh Katdare

    #-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. 

  • Sankareswari Muthiah
    Sankareswari Muthiah

    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.

  • Kaustubh Katdare
    Kaustubh Katdare

    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 -

    • 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. 

    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.

You are reading an archived discussion.

Related Posts

How many of you guys think that the old website of Crazy Engineers is better than this one?
Design News says:Widespread artificial intelligence and a rise in do-it-yourself biohacking are among the trends we should see gathering big momentum sometime in the next decade. That's according to the...
I have have heard that chilled water bottle dispenser just immerse a thin wooden stick preimmersed in  a chemical to chill the water.  Which chemical it could be?Which Chemical chills...
I have taken JEE Main 2019 exam in previous year can i take the same exam again this year
I have done my SSC with 65%, HSC "F" + 1 year extra on re-exam not cleared, again got admission in Diploma on basis of 10th cleared with 60%  yet...