Hi Friends,
I am very new to JSP.Just started learning few days back.I am struck with form validations in JSP.Can you pl help me as to how to validate the inputs entered by user in the form.No alerts shud be there.For example..if user doesnot enter any mandatory column(say first name),it should throw an error on the top of the page saying"Please enter the First name".Hope I am clear with the doubt.Fast help will be highly appreciated...thanks a lot

8 Years
Discussion Span
Last Post by peter_budo

Two basic options

  1. Submit data to servlet for validation (full check as in regards is there any input, is the input in correct format and do the data match with whatever is in database - in case of login action)
  2. Use JavaScript traditionally used for just general check if the fields are filled and correct format (number of characters and no forbidden characters), option selected. You can also do DB connectivity, but you will need AJAX

Thanks a lot for your help.can you provide me with any example code for 1st option...and one more thing in 2nd option if we write java script validation...will be alert kind??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.