title: Why my servlet doesn't run?
body: <p>Here is my html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="ISO-8859-1"&gt;
          &lt;title&gt;Beer Selection Page&lt;/title&gt;
      &lt;/head&gt;
      &lt;body &gt;
          &lt;form method = "post"
              action = "SelectBeer.do"&gt;
              Select beer Characteristics&lt;br/&gt;
              Color:
              &lt;select name="color" size="1"&gt;
                  &lt;option&gt;light
                   &lt;option&gt;amber
                   &lt;option&gt;brown
                   &lt;option&gt;dark
              &lt;/select&gt;
              &lt;br/&gt;&lt;br/&gt;
              &lt;center&gt;&lt;input type="SUBMIT"&gt;&lt;/center&gt; 
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is my xml:</p>
  
  <pre><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" 
      id="WebApp_ID" version="3.0"&gt;
      &lt;display-name&gt;Test2&lt;/display-name&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Ch3 beer&lt;/servlet-name&gt;
          &lt;servlet-class&gt;BeerSelect&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Ch3 beer&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/SelectBeer.do&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>And here, is my servlet:</p>
  
  <pre><code>import java.io.IOException;
  import java.io.PrintWriter;
  
  import javax.servlet.*;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.*;
  
  /**
   * Servlet implementation class BeerSelect
   */
  
   public class BeerSelect extends HttpServlet {
  private static final long serialVersionUID = 1L;
  
  /**
   * Default constructor. 
   */
  public BeerSelect() {
      // TODO Auto-generated constructor stub
  }
  
  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws       ServletException, IOException {
      // TODO Auto-generated method stub
      response.setContentType("text.html");
      PrintWriter out = response.getWriter();
      out.println("Beer Selection Advice");
      String c= request.getParameter("color");
      out.println("Got beer color " + c);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And when I run it on the server, the response is </p>
  
  <p>HTTP Status 404 - /Test2/</p>
  
  <hr>
  
  <p>type Status report</p>
  
  <p>message /Test2/</p>
  
  <p>description The requested resource is not available.</p>
  
  <pre><code>Test2
  .....Java Resources
  ...................src
  ......................default package
  .....................................BeerSelect.java
  .....WebContent
  ...............META-INF
  ...............WEB-INF
  ......................lib
  ......................web.xml
  ...............Beer.html
  </code></pre>
  
  <p><strong>Also, does anybody know why the returned String "c" in the servlet is null??</strong></p>