title: How to check whether a button is clicked?
body: <pre><code>  &lt;form action ="PurchaseCheckOut" method="POST" &gt; 
  
                 &lt;input type = submit name="checkout" class ="button" value="Check Out"&gt;
                 &lt;%   if(request.getParameter("checkout") != null)
                 list1.clear(); %&gt;
            &lt;/form&gt;
  </code></pre>
  
  <p>I'm using a ArrayList for list1. So, when I click on the check out button, it will clear all the things in list1. How can I do that ? This is how I do it but it doesn't seems to work.</p>
  
  <p>EDIT :
  Still not working</p>
  
  <pre><code>&lt;form action ="PurchaseCheckOut" method="POST" &gt; 
                 &lt;input type = submit name="checkout" class ="button" value="Check Out" onClick="clearList()"&gt;
            &lt;/form&gt;
         &lt;%!
                  public void clearList()
                  {
                      list1.removeAll(list1);
                  }
              %&gt;        
  </code></pre>