Following is the code for doPost(...) method of a Servlet which deletes records from a table based upon the parameter provided by the html from.

Java Code:
  public void doPost(HttpServletRequest request, HttpServletResponse response) 
throws ServletException, IOException {
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head><title>Item deleted</title></head>");
    out.println("<body bgcolor=\"#ffffff\">");
    out.println("<p>The given Item is removed from the Cart.</p>");
    out.println("</body></html>");
    try{
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con = DriverManager.getConnection("jdbc:odbc:books");
        Statement st = con.createStatement();
        int i= st.executeUpdate("delete * from cart where itemid like
        "+request.getParameter("delete"));

    }catch(Exception e){e.printStackTrace();}

  }