title: Spring 3 -- form with 2 buttons, sending 2 parameters to controller method
body: <p>I have a Spring 3 MVC form with 2 parameters I'm trying to send to my controller method, and I'm getting a 404 error.  The twist on this problem is that the form has 2 submit buttons, and the submit button that is clicked dictates the value of one of the parameters.  Here is my form.</p>
  
  <pre><code>    &lt;form:form action="/approve/${bulletin.id}" method="post"&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td colspan="2"&gt;&lt;b&gt;From:&lt;/b&gt; &lt;c:out value="${bulletin.name}" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan="2"&gt;&lt;b&gt;Subject:&lt;/b&gt; &lt;c:out
                          value="${bulletin.subject}" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan="2"&gt;&lt;b&gt;Date:&lt;/b&gt; &lt;c:out value="${bulletin.date}" /&gt;
                      &lt;br&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan="2"&gt;&lt;t:notePrint note="${bulletin.note}" /&gt; &lt;input
                      type="hidden" name="id" value="${bulletin.id}" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;input type="submit" name="approve" value="Approve" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="submit" name="deny" value="Deny" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
          &lt;br /&gt;
      &lt;/form:form&gt;
  </code></pre>
  
  <p>Here is my controller form.</p>
  
  <pre><code>@RequestMapping(value = "/approve/{id}", method = RequestMethod.POST)
  public String approveBulletin(@RequestParam int id,
          @RequestParam(required = false, value = "approve") String approve,
          @RequestParam(required = false, value = "deny") String deny, Model model) {
      try {
          if (approve.equalsIgnoreCase("approve")) {
              bulletinDAO.approveBulletin(id);
              model.addAttribute("approval",
                      "Your bulletin has been approved.");
          }
          if (deny.equalsIgnoreCase("deny")) {
              bulletinDAO.denyBulletin(id);
              model.addAttribute("approval", "Your bulletin has been denied.");
          }
  
          List&lt;Bulletin&gt; bulletins = bulletinDAO.getApprovedBulletins();
          model.addAttribute("bulletins", bulletins);
      } catch (Exception e) {
          System.out.println(e.getMessage());
          return "FailurePage";
      }
  
      return "ApproveBulletin";
  }
  </code></pre>