index.html
<html>
<head>
<title>Login Page</title>
</head>
<body>
<form action="checkdetails.jsp">
<fieldset>
<legend>Enter User Id and Password...!!!</legend>
UserId:      <input type="text" name="id" /> <br><br>
Password: <input type="text" name="pass" /> <br><br>
</fieldset>
<div align=center>
<input type="submit" value="Sign In!!"/>
</div>
</form>
</body>
</html>
checkdetails.jsp
<html>
<head>
<title>Check Credentials</title>
</head>
<body>
<%
String uid=request.getParameter("id");
String password=request.getParameter("pass");
session.setAttribute("session-uid", uid);
if(uid.equals("Sachin") && password.equals("Sachin"))
{
response.sendRedirect("success.jsp");
}
else {
43 response.sendRedirect("failed.jsp");
}
%>
</body>
</html>
success.jsp
<html>
<head><title>Success Page</title></head>
<body>
<%
String data=(String)session.getAttribute("session-uid");
out.println(" Login Successfully...!!!");
%>
</body>
</html>
failed.jsp
<html>
<head><title>Sign-in Failed Page</title></head>
<body>
<%
String data2=(String)session.getAttribute("session-uid");
out.println(" User Id and Password are wrong. Please try Again.");
%>
</body>
</html>