title: better way to call java methods from jsp form submission
body: <p>I'm beginner to java and i read a lot of article about posting data into java class , using Servlet ,or on click method. (read <a href="https://stackoverflow.com/questions/14723812/how-do-i-call-a-specific-java-method-on-click-submit-event-of-specific-button-in">this</a> article)</p>
  
  <p><strong>MY CODE</strong></p>
  
  <pre><code>&lt;form action="test/login" method="post" role="form"&gt;
       &lt;input type="text" class="form-control" name="username" id="username" placeholder="username" autocomplete="off" /&gt;
       &lt;input type="password" class="form-control" name="password" id="password" placeholder="password" autocomplete="off" /&gt;
       &lt;input type="submit" name="btnLogin" value="Login" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>JAVA CLASS</strong></p>
  
  <pre><code>public class test{
       public function login(username,password){
            //do something.
       }
  }
  </code></pre>
  
  <p>but any better way to call .java class method after form submission?</p>
  
  <p>is it possible? or the only way is Servlet ?</p>
  
  <p>Servlet vs Ajax call, which act better?</p>