<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >
<script type= "Text/javascript" >
function On_submit ()
{//Verify the legality of the data
if (Form1.username.value = = "")
{
Alert ("User name cannot be empty, please enter user name!") ");
Form1.username.focus ();
return false;
}
if (Form1.userpassword.value = = "")
{
Alert ("The user password cannot be empty, please enter the password!") ");
Form1.userpassword.focus ();
return false;
}
if (Form1.reuserpassword.value = = "")
{
Alert ("The user confirms that the password cannot be empty, please enter the password!") ");
Form1.reuserpassword.focus ();
return false;
}
if (form1.userpassword.value! = form1.reuserpassword.value)
{
Alert ("Password differs from confirmation password");
Form1.userpassword.focus ();
return false;
}
if (form1.email.value.length!= 0)
{
for (i=0; i<form1.email.value.length; i++)
if (form1.email.value.charAt (i) = = "@")
Break
if (i==form1.email.value.length)
{
Alert ("Illegal email address! ");
Form1.email.focus ();
return false;
}
}
Else
{
Alert ("Please enter email! ");
Form1.email.focus ();
return false;
}
}
</script>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title> New User Registration </title>
<body>
<form method= "POST" action= "accept.jsp" Name= "Form1" onsubmit= "Return On_submit ()" >
New User Registration <br>
Username (*): <input type= "text" name= "username" size= "><br>"
Secret Code (*): <input type= "password" name= "UserPassword" size= "><br>"
Lose password Again (*): <input type= "password" name= "Reuserpassword" size= "><br>"
Gender: <input type= "Radio" value= "male" checked name= "sex" > Male <input type= "Radio" name= "Sex" value= "women" > Women <br>
Date of birth: <input name= "Year" size= "4" maxlength=4> years
<select name= "Month" >
<option value= "1" selected>1</option>
<option value= "2" >2</option>
<option value= "3" >3</option>
<option value= "4" >4</option>
<option value= "5" >5</option>
<option value= "6" >6</option>
<option value= "8" >7</option>
<option value= "9" >9</option>
<option value= "Ten" >10</option>
<option value= "One" >11</option>
<option value= ">12</option>"
</select> Month
<input name= "Day" size= "3" maxlength=4> <br>
e-Mail (*): <input name= "Email" maxlength=28><br>
Home Address: <input type= "text" name= "Address" size= "><br>"
<input type= "Submit" value= "commit" Name= "B1" ><input type= "reset" value= "Overwrite All" name= "B2" ><br>
</form>
</body>
Java Web Experiment register.jsp