title: Understanding how to run a servlet in Eclipse
body: <p>I'm writing a simple flight reservation application for one of my homeworks.  My flight reservation web site has a login, registration, flight search, result display and confirmation JSP pages.  I want to invoke servlets when the user attempts to perform an action, for example:  </p>
  
  <p>The user goes to login.jsp and clicks the Login button, the form has a target /core/Login (core is my core servlets and Login is the corresponding servlet that should handle that request).</p>
  
  <p>In a previous homework we wrote our own web server, so I didn't use Tomcat to deploy the serlvet... now that we're no longer using our own web server, I'm having some trouble figuring out how to get the servlets to run in Eclipse.</p>
  
  <p>I created a Dynamic Web Project in Eclipse and it automatically generated the following folder structure:</p>
  
  <pre><code>../P3  
  ../P3/src  
  ../P3/src/core  
  ../P3/build  
  ../P3/WebContent 
  ../P3/WebContent/META-INF  
  ../P3/WebContent/WEB-INF  
  </code></pre>
  
  <p>My login.jsp has a form which when filled out and clicked submits the results to the Login servlet in my core package:  </p>
  
  <pre><code> &lt;form name="input" action="src/core/Login" method=GET&gt;
    Username: &lt;input type="text" name="userName" /&gt;
    &lt;br&gt;
    Password: &lt;input type="password" name="password" /&gt;
    &lt;br&gt;
    &lt;input type="submit" value="Login" /&gt;
   &lt;/form&gt; 
  </code></pre>
  
  <p>Eclipse has a built in browser, so when I run the login.jsp it loads it in the Eclipse browser and displays it.  When I click the Login button it's supposed to send the userName and the password to the Login servlet, but I get the following error instead:  </p>
  
  <pre><code>HTTP Status 404 - /P3/src/core/Login
  
  --------------------------------------------------------------------------------
  
  type Status report
  
  message /P3/src/core/Login
  
  description The requested resource (/P3/src/core/Login) is not available.
  </code></pre>
  
  <p>For some reason the server doesn't know about the servlet... I've read a couple (<a href="http://eclipse.dzone.com/tips/wtp-tomcat-classpath-and-web-inflib?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+eclipsezone%2Ffrontpage+%28Eclipse+Zone%29" rel="nofollow noreferrer">first</a> and <a href="http://greatwebguy.com/programming/eclipse/make-eclipse-and-tomcat-play-nice-together/" rel="nofollow noreferrer">second</a>) of articles online explaining the possible problems, but I'm still getting the error.  I tried the solution in the first article and it didn't work; the second article didn't really apply since the server settings.xml file already contained the correct flags and directories.  </p>
  
  <p>Here is my WEB-INF/web.xml file:</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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
    &lt;display-name&gt;P3&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;login.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
    &lt;servlet&gt;
      &lt;description&gt;&lt;/description&gt;
      &lt;display-name&gt;Registration&lt;/display-name&gt;
      &lt;servlet-name&gt;Registration&lt;/servlet-name&gt;
      &lt;servlet-class&gt;core.Registration&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Registration&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/Registration&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;servlet&gt;
      &lt;description&gt;&lt;/description&gt;
      &lt;display-name&gt;Register&lt;/display-name&gt;
      &lt;servlet-name&gt;Register&lt;/servlet-name&gt;
      &lt;servlet-class&gt;core.Register&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Register&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/Register&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;servlet&gt;
      &lt;description&gt;&lt;/description&gt;
      &lt;display-name&gt;Login&lt;/display-name&gt;
      &lt;servlet-name&gt;Login&lt;/servlet-name&gt;
      &lt;servlet-class&gt;core.Login&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Login&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/Login&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>How should I setup my project so it properly deploys in Eclipse?</p>