title: Using a single Servlet for multiple HTML forms
body: <p>I am new to Java's JSP and Servlets.</p>
  
  <p>I am trying to control two different HTML forms with single Servlet Controller. The approach that I am following, is creating a hidden field in both forms, then, in my Servlet I've written:</p>
  
  <pre><code>String extra= request.getParameter("value"); 
  //value is name of hidden textbox in my both forms
  </code></pre>
  
  <p>then, using <code>if-else</code></p>
  
  <pre><code>if(extra.equals(x))
    do this....
  else if(extra.equals(y))
    do this...
  </code></pre>
  
  <p>My question is, Is there any better approach to solve this problem? My implementation is very tedious, and I want to use single servlet in my whole application.</p>