title: JSP pass parameter to servlet according to button clicked
body: <p>I have the following JSP which contains a form. The user should be able to update and delete, so I have two buttons for these options:</p>
  
  <pre><code>&lt;form method="GET" action ="${pageContext.request.contextPath}/CurrencyController"&gt;
          Currency code: &lt;input type="text" name="currencyCode" id="currencyCode" value="${currency.currencyCode}" /&gt; 
          &lt;br/&gt;
          &lt;input type="submit" value="Update" &gt;
          &lt;input type="submit" value="Delete"/&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>In my servlet <code>CurrencyController</code> I retrieve the <code>action</code>:</p>
  
  <pre><code> protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          String action = request.getParameter("action");
  
          if (action.equalsIgnoreCase("update")){
          ...
          if (action.equalsIgnoreCase("delete")){
          ...
  </code></pre>
  
  <p>So how can I pass the value for <code>action</code> in my form? It should be <code>update</code> if the first button is clicked and <code>delete</code> if the second button is clicked</p>