title: My jsp cannot find my servlet, giving me a 404
body: <p>I am trying to submit a simple form for processing in a servlet, but I keep getting a 404 whenever I submit.  The code compiles and deploys fine.  I've been through just about every tutorial on the subject, so I understand that there is a lot of information out there about it.  Any advice on which rookie mistake I am making? Thanks in advance for any help!</p>
  
  <p>jsp is located in /webapps/registerWidget
  servlet located in /webapps/registerWidget/WEB-INF/classes/com/sample/applet
  web.xml located in /webapps/registerWidget/WEB-INF</p>
  
  <p>Here is my jsp:</p>
  
  <pre><code>    &lt;!DOCTYPE HTML&gt;
      &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Sample Applet&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;header&gt;Please Register&lt;/header&gt;
          &lt;section&gt;
              &lt;form action="/register" method="POST"&gt;
                  First name: &lt;input type="text" name="firstname"&gt;&lt;br&gt;
                  Last name: &lt;input type="text" name="lastname"&gt;&lt;br&gt;
                  Email: &lt;input type="text" name="email"&gt;&lt;br&gt;
                  &lt;input type="submit" value="Submit"&gt;
              &lt;/form&gt;
          &lt;/section&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is my servlet:</p>
  
  <pre><code>package com.sample.applet;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  public class RegisterServlet extends HttpServlet {
  
      public void doGet(HttpServletRequest req, HttpServletResponse res)
              throws IOException, ServletException {
          doPost(req, res);
      }
  
      public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws ServletException {
  
          String first = req.getParameter("firstname");
          String last = req.getParameter("lastname");
          String email = req.getParameter("email");
  
          ....some processing code....
  
      }
  }
  </code></pre>
  
  <p>Here is my web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
      http://java.sun.com/xml/ns/j2ee/Web-app_2_4.xsd"&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;registerServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.sample.applet.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;/register&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>