title: Thymeleaf - Button click to call http delete method
body: <p>I would like to call the url via http delete method. I tried th:onclick and th:action but not working.</p>
  
  <p>html code:</p>
  
  <pre><code>&lt;button id="delete" name="delete" th:onclick="@{'/foos/{id}'(id=${foo.id})}" th:method="delete"&gt;Delete&lt;/button&gt;
  </code></pre>
  
  <p>controller code:</p>
  
  <pre><code>@RequestMapping(value="/foos/{id}", method = RequestMethod.DELETE)
  @ResponseBody
  public String delete(@PathVariable String id) {
      studentService.delete(id);
      return "Successfully deleted";
  }
  </code></pre>