title: HTTP Status 404 - The requested resource is not available -
body: <p>I've come to across this issue and spent some time searching here for similar problems, but most cases are related to upper/lower-case mistakes.
  The thing is, on my computer at home it works just fine, but now that I've imported it on my laptop it just wont function right.</p>
  
  <p>I get HTTP Status 404 - /Web/RegisterServlet.do when I try to run a servlet from my jsp file. </p>
  
  <p>My Jsp:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /&gt;
  &lt;title&gt;Dynamic Example&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="RegisterServlet.do" method="post"&gt;
  
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;Username:&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;input type="text" name="username" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;Real name:&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;input type="text" name="realname" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;Password:&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;input type="text" name="password1" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;Password (again):&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;input type="text" name="password2" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;Email:&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;input type="text" name="email1" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;Email (again):&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;input type="text" name="email2" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td align="right"&gt;Address&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;input type="text" name="address" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;Country:&lt;/td&gt;
                  &lt;td align="left"&gt;&lt;input type="text" name="country" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;&lt;input type="submit" value="Register" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
          &lt;/table&gt;
  
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  
  
  <p>My servlet:</p>
  
  <pre><code>package web;
  
  import java.io.BufferedWriter;
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  public class RegisterServlet extends HttpServlet {
  
      protected void doPost(HttpServletRequest req, HttpServletResponse resp)
              throws ServletException, IOException {
          boolean good = true;
          String username = req.getParameter("username");
          String realname = req.getParameter("realname");
          String password1 = req.getParameter("password1");
          String password2 = req.getParameter("password2");
          String email1 = req.getParameter("email1");
          String email2 = req.getParameter("email2");
          String address = req.getParameter("address");
          String country = req.getParameter("country");
  
          if (username == "" || realname == "" || password1 == ""
                  || password2 == "" || email1 == "" || email2 == ""
                  || address == "" || country == "") {
              good = false;
          }
  
          if (!password1.equals(password2)) {
              good = false;
          }
  
          if (!email1.equals(email2)) {
              good = false;
          }
  
          if (good == false) {
              resp.sendRedirect("Register.jsp");
          } else {
  
              FileWriter fw = new FileWriter("users.txt", true);
  
              PrintWriter pw = new PrintWriter(fw);
              pw.println("[" + username + "][" + realname + "][" + password1
                      + "][" + email1 + "][" + address + "][" + country + "]");
              pw.close();
  
              req.getRequestDispatcher("Login.jsp").forward(req, resp);
          }
  
      }
  }
  </code></pre>
  
  <p>My xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0"&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Dynamic Example Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;web.LoginServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Dynamic Example Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/LoginServlet.do&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Dynamic Example Servlets&lt;/servlet-name&gt;
          &lt;servlet-class&gt;web.RegisterServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Dynamic Example Servlets&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/RegisterServlet.do&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>My file setup:
  <a href="http://i.stack.imgur.com/U3Qg5.png" rel="nofollow">http://i.stack.imgur.com/U3Qg5.png</a></p>