vendredi 31 mars 2017

How to check java-script,which is in JSP function output in java servlet file or scriptlets

Here my aim is to submit this form to servlet, which will built process DB query. I have validated the mail using javascript. Normally when i click submit it will validate email and prompt user for false format of mail and simultaneously pass to servlet all information which make query and insert into DB. But the validation of mail gives false mail. So how can i pass javascript function value to servlet to to validate first and then built query and insert into database? We can use Scriptlet also.

Javascript:

function ValidateEmail(inputText) { var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; if(inputText.value.match(mailformat)) { document.text1.focus(); return true; } else { alert("You have entered an invalid email address!"); document.text1.focus(); return false; } }

jsp:
Sign Up

Provide code snippet of scriplet for solution.




Aucun commentaire:

Enregistrer un commentaire