title: Delete function using jsp and servlet
body: <p>Hi can someone help me to figure out where is my silly mistake.
  i am trying to find out in internet but couldnot find the best solution. i have a jsp and java controller where i should be able to delete a record from the databas, following is my code. any help will be acknowledge</p>
  
  <pre><code>public void doDel(HttpServletRequest request, HttpServletResponse response) throws ClassNotFoundException, InstantiationException, IllegalAccessException{
  
          try {
                  HttpSession session = request.getSession(true);
                  messageBean mbean = new messageBean();
                 int id = mbean.getMesId();
                 String sql;
                 sql = "DELETE * from message where id =?";
                 Class.forName(driver).newInstance();
                  conn = DriverManager.getConnection(url);
                  st = conn.createStatement();
                  ps = conn.prepareStatement(sql);
                  ps.setInt(1, id);
                  ps.executeUpdate();
                  conn.commit();
                  conn.close();
  </code></pre>