Create a registration form and put validation checks on values entered by the users using java scripts.
Program Code:
StudentLogin.jsp
<%@ page contentType="text/html; charset=iso-8859-1" language="java" errorPage="ErrorPage.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Login Page</title>
<link rel="stylesheet" href="stylesheet/Style.css" type="text/css"/>
<script type="text/javascript">
function val()
{
if(document.form1.studentId.value=="")
{
alert("Please Enter Your Login ID");
document.form1.studentId.focus();
return false;
}
if(document.form1.studentPassword.value=="")
{
alert("Please Enter Your Password");
document.form1.studentPassword.focus();
return false;
}
}
</script>
</head>
<body onLoad="javascript:document.form1.studentId.focus()">
<form name="form1" method="post" action="Student_Login_Handler.jsp" onSubmit="return val()">
<table width="100%" height="100%" cellpadding="3" cellspacing="0" >
<tr>
<td bgcolor="#E1E1E1" height="15%"><%@ include file="Header.jsp" %></td>
</tr>
<tr>
<td width="100%" height="80%" align="center" valign="baseline"><table width="90%" cellpadding="3" cellspacing="0" >
<tr>
<td width="8%"><a href="Home.jsp" class="stylelink" style="text-decoration:none; font-family: "Times New Roman", Times, serif;">Home</a></td>
<td width="35%" align="center"> </td>
<td width="27%"> </td>
<td width="30%" align="right"><a href="Student_Registration.jsp" class="stylelink" style="text-decoration:none ; font-weight: bold;">New Student Click Here</a></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<% if(session.getAttribute("message") != null)
{
%>
<tr>
<td colspan="4" class="stylegreen" align="center"><%= session.getAttribute("message")%></td>
</tr>
<%
session.removeAttribute("message");
}
%>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="4"><table width="40%" border="1" align="center" bordercolor="#CCCCCC" bgcolor="#CCCCCC">
<tr align="center" bgcolor="#999999">
<td colspan="2" class="stylebig">Student Login Here</td>
</tr>
<tr bgcolor="#E1E1E1">
<td colspan="2"> </td>
</tr>
<tr bgcolor="#E1E1E1" class="stylesmall">
<td width="35%" class="style7">Login Id: </td>
<td width="65%"><input name="studentId" type="text" id="studentId"></td>
</tr>
<tr bgcolor="#E1E1E1" class="stylesmall">
<td class="style7">Password:</td>
<td><input name="studentPassword" type="password" id="studentPassword"></td>
</tr>
<% if(request.getParameter("valid") != null && request.getParameter("valid").equals("invalid")) { %>
<tr bgcolor="#E1E1E1">
<td colspan="2" align="center" class="stylered">Invalid Login Id or Password.</td>
</tr>
<% } %>
<tr bgcolor="#E1E1E1">
<td colspan="2" align="center"><input name="login" class="style10" type="submit" id="login" value="Login">
<input name="close" type="button" id="close" class="style10" value="Close" onClick="self.location='Home.jsp'"> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="5%" align="center" ><%@ include file="Footer.jsp" %></td>
</tr>
</table>
</form>
</body>
</html>
Post A Comment:
0 comments: