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

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??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.