Log in

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

<html>

<head>
<title>JSP Page</title>
<script>
function loginValidation()
{

var theForm=window.document.forms[0];
var uName=theForm.userName.value;
var pWord=theForm.password.value;
var uType=theForm.userType.value;
if(uName=="")
{
alert("Please enter username!");
theForm.userName.focus();
return false;
}
if(pWord=="")
{
alert("Please enter password");
theForm.password.focus();
return false;
}
if(uType=="S")
{
alert("Please select the right criteria");
theForm.userType.focus();
return false;
}
if((uName=="admin" && pWord=="admin" && uType=="1")
|| (uName=="dataentry" && pWord=="dataentry" && uType=="2")
{

}
else
{
alert("invalid user");
uName="";
pWord="";
uType="S";

theForm.userName.focus();
return false;
}

}
</script>
</head>
<body>
<html:form action="/logon" onsubmit="return loginValidation();">

<br><br> <div align="center" class="pageHead"><b>User Login


Screen</b></div><br>

<table border="2" align="center" class="bodyContent" width="30%" height="80%"


cellpadding="0">
<tr>
<td align="right" colspan="2" nowrap>User Name:</td>
<td align="left" class="bodyTextVal" nowrap><html:text
property="userName"/></td>
</tr>
<tr>
<td align="right" colspan="2" nowrap>Password:</td>
<td align="left" class="bodyTextVal" nowrap><html:password
property="password"/></td>
</tr>

<tr>
<td align="right" colspan="2" nowrap>User Type:</td>
<td align="left" class="bodyTextVal" nowrap><html:select
property="userType">
<option value="S"> --Select-- </option>
<option value="1">admin</option>
<option value="2">User</option>
</html:select> </td>
</tr>

<tr> <td colspan="4" align="center"><html:submit


value="Submit"></html:submit></td></tr>
</table>
</html:form>
</body>
</html>

You might also like