Code: <%-- Document : login Created on : 12 Sep, 2012, 4:30:37 PM Author : sanidhya09 --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Login Page</title> <link rel="stylesheet" href="css/margin.css" type="text/css" /> </head> <body background="images/medicallogo.png"> <form name="form" method="post" action="login.jsp" > <table background="images/bg1.gif" id="table" width="1000" height="500" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td> <div id="Header"> <%@ include file="Header2.jsp" %> </div> <div id="body"> <table id="body1" width="750" height="500" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td> <%--Database Connectivity --%> <%@page import="java.sql.*"%> <%@page import="Hospital.Database_Connectivity;"%> <% try{ Connection con; Statement smt; ResultSet rs; String user=request.getParameter("user_id"); String pass=request.getParameter("password"); //Class.forName("com.mysql.jdbc.Driver").newInstance(); //connection =DriverManager.getConnection("jdbc:mysql://localhost:3306/hospital", "root", ""); con=Database_Connectivity.dbcon(); smt=con.createStatement(); rs=smt.executeQuery("select * from login where user_id='"+user+"' and password='"+pass+"'"); if(rs.next()) { while(rs.next()) { String str=rs.getString("type"); if(str.equals("employee")) { response.sendRedirect("index.jsp"); } } } else { out.println("Not valid Credentials"); // response.sendRedirect("login.jsp"); } } catch(Exception ex) { System.out.println("Error="+ex); } %> <p align="center"><font face="Arial Black" color="#800000"><b>PLEASE LOGIN HERE</b></font></p> <table cellpadding="0" cellspacing="0" width="300" height="250" BORDER="0" align="center"> <tr> <td> <font color="#000080" face="arial"/>USERNAME : </td> <td> <input type="text" name="user_id" size="20" id="user_id" /> </td> </tr> <tr> <td> <font face="arial" color="#000080" />PASSWORD : </td> <td> <input type="password" name="password" size="20" id="password" /> </td> </tr> <tr> <td> <font face="arial" color="#000080" />COUNTER : </td> <td> <select size="1" name="Counter"> <option>Counter 1</option> <option>Counter 2</option> <option>Counter 3</option> <option>Counter 4</option> <option>Counter 5</option> </select> </td> </tr> <tr> <td> <font face="arial" color="#000080" />Remember Me : </td> <td> <input type="CHECKBOX" name="checkbox" /> </td> </tr> <tr align="right"> <td> <button name="reset" type="reset" style="background-color:lightseagreen">RESET</button> </td> <td> <button name="login" style="background-color:lightseagreen">LOGIN</button> </td> </tr> </table> </td> </tr> </table> </div> <div id="footer"><br /> <%@ include file="footer2.jsp" %> </div> </td> </tr> </table> </form> </body> </html>