title: java servlet 404 not found
body: <p>the servlet is </p>
  
  <pre><code>import javax.servlet.*;
  import javax.servlet.http.*;
  import java.io.*;
  
  public class ServletWriteHtml extends HttpServlet
  {
  public void doGet(HttpServletRequest request, HttpServletResponse response)
          throws IOException
  {
      PrintWriter out = response.getWriter();
      java.util.Date today = new java.util.Date();
      out.println("html" +
                  "&lt;body&gt;" +
                  "&lt;h1 align = center&gt;Write Html&lt;h1&gt;"
                  + "&lt;br&gt;" + today + "&lt;body&gt;" + "&lt;/html&gt;");                        
          }
  }
  </code></pre>
  
  <p>the web.xml is </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app id="file-upload" 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;And&lt;/servlet-name&gt;
          &lt;servlet-class&gt;ServletWriteHtml&lt;/servlet-class&gt;
      &lt;/servlet&gt;  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;ServletWriteHtml&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/Alfa&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
          &lt;welcome-file-list&gt;
              &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
          &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>the url is <a href="http://localhost:8080/JavaWeb/Alfa" rel="nofollow noreferrer">http://localhost:8080/JavaWeb/Alfa</a>
  compiled the servlet and class is in WEB-INF folder</p>
  
  <p>HTTP Status 404 - Not Found
  type Status report
  messageNot Found
  descriptionThe requested resource is not available.
  GlassFish Server Open Source Edition 4.1.1</p>