title: deleting data from mysql database trough servlet / jsp
body: <p>I have a servlet that calls MySQL database.</p>
  
  <p>The <code>deletePage</code> method looks like this: </p>
  
  <pre><code>public void  deletePage(PageData delete) {
      String firstQuery ="Delete FROM pages Where ID= '"+delete.getId()+"';";
  
      try {
          statement = connection.createStatement();
          statement.executeUpdate(firstQuery);
          System.out.println("Expense is deleting");
  
      } catch (SQLException e) {
          System.out.println("Expense isn't deleting - SQLException");
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>The <code>delete.jsp</code> is as follows: </p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;Add pages&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form action="adminController"&gt;
              &lt;p&gt;
                  &lt;input type="hidden" name="operation" value="deletepage" /&gt;
                  &lt;input type="hidden" name="parentid" value="&lt;%= request.getParameter("id") %&gt;" /&gt;
                  Enter ID of page you want to delete:&lt;input name="id"&gt;&lt;br&gt;
  
                  &lt;input type="submit" /&gt;
              &lt;/p&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The <code>mainadmin.jsp</code>:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;Insert title here&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;%= request.getAttribute("menu") %&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>if you run this code you'll see that my delete buttons stands after each page name.
  what i want to do is by pressing the delete button near the page to delete this page, there should be something like "are you sure you want to delete?", submit button"delete". but what i have managed to do looks like this(as in my code): whenever delete button is pressed, you have to enter id of page you want to delete, so no matter what delete button i press, it requests for id. but i just want to delete it right away.
  can anyone help? </p>