<% String un=request.getParameter("username"); String pass=request.getParameter("password"); Connection conn = null; boolean i=false; int flag=0; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException e) { out.println("exceptoin 0"); } // connect to DB try{ conn = DriverManager.getConnection("jdbc:odbc:SIM","sanket","raut8989"); } catch(SQLException se1) { out.println("exception 1"); } //out.println("connection is successful!!!"); try{ Statement stmt = conn.createStatement(); ResultSet rs=stmt.executeQuery("select * from authen"); while(rs.next()) { if(rs.getString(1).equals(un.trim()) && rs.getString(2).equals(pass.trim())) { i=true; } if(i==true) { session.setAttribute("username",un); flag=1; RequestDispatcher dispatcher = request.getRequestDispatcher("home.jsp"); if (dispatcher != null) dispatcher.forward(request, response); } else { flag=0; out.println("Wromg username password"); } } } catch(SQLException s5) { out.println(s5); } %>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)