<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %> Untitled Document <% Connection con; ResultSet rs; Statement st; String username=request.getParameter("username"); String password=request.getParameter("password"); String persinfo; String pubhead; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost/iitDB","root","91don699629"); st=con.createStatement(); rs=st.executeQuery("select username,password,persinfo,cphead from adminfac where username='"+username+"' and password='"+password+"'"); if(rs.next()) { out.println(username); out.println(password); persinfo = rs.getString("persinfo"); pubhead=rs.getString("cphead"); if(pubhead!=null) { out.println("jai"); } else{ out.println("chan"); } %>
<% out.println(persinfo); out.println(pubhead); } else { %> <% } } catch(SQLException sqle) { System.err.println(sqle.getMessage()); } catch (ClassNotFoundException cnfe){ System.err.println(cnfe.getMessage()); } catch (Exception e){ out.println(e.getMessage()); out.println("sql Exexption"); } %>