title: Unable to call servlet from form action
body: <p>I have a form in which I want to submit request to a servlet called registrationServlet.The register servlet is under a directory called &quot;Controller&quot;. But it fails to access the servlet after submitting the form. How can I resolve this issue? I get the following error after submitting the form</p>
  <blockquote>
  <p>HTTP Status 404 - /ClassProject/Views/RegisterServlet</p>
  <p>description : The requested resource is not available.</p>
  </blockquote>
  <p>form : <strong>(Form resides in Login.jsp page under Views directory)</strong></p>
  <pre><code>    &lt;form action=&quot;RegisterServlet&quot; class=&quot;register&quot; method=&quot;POST&quot; &gt;
          &lt;fieldset&gt;
              &lt;legend&gt;Registration&lt;/legend&gt;
              Username : &lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot;&gt;
              &lt;/br&gt;&lt;/br&gt;
  
              Password : &lt;input type=&quot;password&quot; name=&quot;password&quot; id=&quot;password&quot;&gt;
              &lt;/br&gt;&lt;/br&gt;
              Email : &lt;input type=&quot;email&quot; name=&quot;email&quot; id=&quot;email&quot;&gt;
              &lt;/br&gt;&lt;/br&gt;
              Date of Birth : &lt;input type=&quot;date&quot; name=&quot;date&quot; id=&quot;date&quot;&gt;
              &lt;/br&gt;&lt;/br&gt;
              &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;
          &lt;/fieldset&gt;
      &lt;/form&gt;
  </code></pre>
  <p>web.xml :</p>
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;RegisterServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;Controller.RegisterServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;RegisterServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/RegisterServlet&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  <p>Here is my directory structure :</p>
  <p><a href="https://i.stack.imgur.com/16rGr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/16rGr.png" alt="enter image description here" /></a></p>