I am learning Java Servlets and I am working on a simple homework assignment. I have an html page containing a form, that is submitted to a servlet, does some processing, and uses a printwriter to render an html page with results.
Now, I want to add Javascript, which I am familiar with. Is there a way that I can write a Javascript function to validate data in the form, and if the data is valid, then call the servlet, otherwise, don't call the servlet?