How to send a form contained in a JSP page to a Servlet properly
<p>I have this form declaration in my JSP page:</p>

<pre><code>&lt;form name="login" method="post" action="loginServlet"&gt; 
</code></pre>

<p>Assume that the servlet is appropriately declared in the web.xml file; with this pattern <code>&lt;url-pattern&gt;/loginServlet&lt;/url-pattern&gt;</code>; </p>

<p>this <code>servlet</code> contains a doPost method. </p>

<p>But what happens is that when I press the button associated to the login form, the server complains that this servlet is not found. What kind of path should I use in order to make it work? </p>

<p>This is the folder structure of my project:</p>

<pre><code>-Project0
   -jsppages
      login.jsp
   +htmlpages
   -WEB-INF
      -classes 
          LogIn.class
</code></pre>

<p>I guess there's a problem with the path. How could I fix this. Thank you!</p>

<p>Edit: the web.xml contains exactly this referred to my servlet:</p>

<pre><code>  &lt;servlet&gt;
      &lt;servlet-name&gt;LogInServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;LogIn.class&lt;/servlet-class&gt;
   &lt;/servlet&gt;

   &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;LogInServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/loginServlet&lt;/url-pattern&gt;
   &lt;/servlet-mapping&gt;
</code></pre>

<p>SOLVED:</p>

<p>When calling the action releted to the form, it was necessary to go out of the JSP folder in my project folder by using the path ../loginsServlet so it becomes like this.</p>

<pre><code>&lt;form name="login" method="post" action="../loginServlet"&gt; 
</code></pre>