title: I can't delete a row in database via servlet. My IDE is IntelliJ
body: <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;View Shopping Cart&lt;/title&gt;
      &lt;script type="text/javascript"&gt;
  
          function remove(book_id)
          {
              document.getElementById('bookId').value = book_id;
              document.forms[0].submit();
          }
  
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;table border="1" id="bookTable"&gt;
          &lt;tr&gt;
              &lt;th&gt;Book ID&lt;/th&gt;
              &lt;th&gt;Book Name&lt;/th&gt;
              &lt;th&gt;Author&lt;/th&gt;
              &lt;th&gt;Quantity&lt;/th&gt;
              &lt;th&gt;Remove from cart&lt;/th&gt;
          &lt;/tr&gt;
          &lt;%
              try
              {
                  int cus_id = Integer.parseInt(session.getAttribute("cusId").toString());
                  ResultSet rs = SqlConnection.getData("select * from book b, shopping_cart s where s.book_id=b.book_id AND s.cus_id=" + cus_id);
  
                  if (!rs.first())
                  {
                      out.print("&lt;h3&gt;Nothing in the Cart!&lt;/h3&gt;");
                  }
                  else
                  {
                      rs.previous();
  
                      while (rs.next())
                      {
          %&gt;
          &lt;tr&gt;
                          &lt;%
                              out.print("&lt;td&gt;" + rs.getInt("book_id") + "&lt;/td&gt;");
                              out.print("&lt;td&gt;" + rs.getString("book_name") + "&lt;/td&gt;");
                              out.print("&lt;td&gt;" + rs.getString("author_name") + "&lt;/td&gt;");
                              out.print("&lt;td&gt;&lt;input type='number' name='qty' id='qty'/&gt;&lt;/td&gt;");
                              out.print("&lt;td&gt;&lt;input type='button' onClick='remove(" + rs.getInt("book_id") + ")' value='Remove from cart'/&gt;&lt;/td&gt;");
                          %&gt;
          &lt;/tr&gt;
          &lt;%
                      }
                  }
              }
              catch (Exception e)
              {
                  e.printStackTrace();
              }
          %&gt;
      &lt;/table&gt;&lt;br/&gt;&lt;br/&gt;
  
      &lt;p style="color: green;"&gt;${successful}&lt;/p&gt; &lt;br/&gt;
      &lt;p style="color: red;"&gt;${error}&lt;/p&gt; &lt;br/&gt;
      &lt;a href="viewBooks.jsp"&gt;&lt;input type="button" value="View Books"&gt;&lt;/a&gt;
      &lt;a href="welcome.jsp"&gt;&lt;input type="button" value="Home"&gt;&lt;/a&gt;
  
      &lt;form action="/ShoppingCartRemoving" method="post"&gt;
          &lt;input type="hidden" name="bookId" id="bookId"/&gt;
      &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is the JSP code. I checked and realized that this never makes it to the servlet. But another JSP page that has the this same structure works fine. It's confusing. I'm trying to delete items from a shopping cart.</p>
  
  <p>The JavaScript function is to get the bookId and put it in the hidden input field in form and then submit the form. This exact code worked fine in another JSP page.</p>