title: How to match field Value in from database in jsp?
body: <p>i have a registration from in jsp with two field username and password i insert these field in database. before insert i want to check if username is already exist then do not insert that in db and print any meaning full message.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>String user = request.getParameter("user");
     String pass = request.getParameter("pass");
  try{
  Class.forName("com.mysql.jdbc.Driver");
          Connection  cn = DriverManager.getConnection("jdbc:mysql://localhost:3306/Court","root","Dan@1234");
   PreparedStatement ps=cn.prepareStatement("insert into Councel  values(?,?)");
  ps.setString(1,user);
                          ps.setString(2,pass);
   int i=ps.executeUpdate();
                          if(i==1)
  
  }
  catch(Exception e)
                      {
  
                          out.println(e.toString());
                      }
  </code></pre>