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: &quot;Times New Roman&quot;, Times, serif;">Home</a></td>
<td width="35%" align="center">&nbsp;</td>
<td width="27%">&nbsp;</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>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</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">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</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">&nbsp;</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>
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: