title: Resource not found error for servlet
body: <p>I am trying to learn JSP servlets...so i tried to implement the first example in headfirst JSP and Servlets..
  I wrote the following code for my form and servlet and web.xml.
  FORM:</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;h1 align="center"&gt;Beer Selection Page&lt;/h1&gt;
          &lt;form method="POST" action="/SelectBeer.do"&gt;
              Select beer characteristics&lt;p&gt;
              Color:
              &lt;select name="color" size="1"&gt;
                  &lt;option value="light"&gt; light &lt;/option&gt;
                  &lt;option value="amber"&gt; amber &lt;/option&gt;
                  &lt;option value="brown"&gt; brown &lt;/option&gt;
                  &lt;option value="dark"&gt; dark &lt;/option&gt;
              &lt;/select&gt;
              &lt;br&gt;&lt;br&gt;
              &lt;input type="submit"&gt;&lt;/input&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>SERVLET:</p>
  
  <pre><code>package com.example.web;
  import javax.servlet.*;
  import javax.servlet.http.*;
  import java.io.*;
  
  public class beerSelect extends HttpServlet {
      public void doPost(HttpServletRequest request,HttpServletResponse response)throws IOException, ServletException {
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              out.println("Beer Selection Advice&lt;br&gt;");
              String c = request.getParameter("color");
              out.println("&lt;br&gt;Got beer color " + c);
      }
  }
  </code></pre>
  
  <p>WEB.XML:</p>
  
  <pre><code>&lt;web-app 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/web-app_2_4.xsd"
  version="2.4"&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Ch3 Beer&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.example.web.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>Deployed it in apache tomacat 7.0.05 in the webapps folder under the name BeerV1. The form is put in beerV1, the <code>web.xml</code> in <code>WEB-INF</code>, and the servlet class file in <code>D:\apache-tomcat-7.0.50\webapps\beerV1\WEB-INF\classes\com\example\web</code> </p>
  
  <p>When i hit the URL : <code>localhost:8080/beerV1/form.html</code> i get the form, but when i select a colour and hit submit i get a 404. </p>
  
  <p>I tried a lot of sites for a solution but did not get any. I understand that this is a very basic example but please help me figure this out.</p>