<%@ 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 language= "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;
}
}
</script>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title> User Login </title>
<body>
<table aligin= "center" >
<form name= "Form1" method= "Post" action= "station.jsp" onsubmit= "return On_submit ()" >
<TR aligin= "center" >
<td>
User Login
</td>
</tr>
<TR aligin= "center" >
<td>
Please enter user name: <input type= "text" name= "username" size= ">"
</td>
</tr>
<TR aligin= "center" >
<td>
Please enter password: <input type= "password" name= "UserPassword" size= ">"
</td>
</tr>
<TR aligin= "center" >
<td>
<input type= "Submit" value= "Submission" name= "B1" >
<input type= "Reset" value= "all Override" Name= "B2" >
</td>
</tr>
</form>
</table>
</body>
Java Web Experiment login.jsp Session property setting and getting