title: How do I call a Java method on button click event of JSP
body: <pre><code>&lt;p&gt;
      &lt;form action="logout.java" method="post"&gt;
          &lt;input type="button" value="Logout"&gt;
      &lt;/form&gt;
  &lt;/p&gt;
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
          response.sendRedirect("login.jsp");
  }
  </code></pre>
  
  <p>but when i click the button nothing happens?</p>