title: grammar and syntax
body: <p>I've enough knowledge to develop in Java SE/JavaFX (Desktop), but it's my 1st time with Java EE (WEB). I'd like to build a basic app only getting Login and Password in a HTML/JSP, calling a Servlet (in Java) and returning a single message to the HTML/JSP. This time I want to do that the "hard way", without any IDE. So, I've installed Tomcat 7.0 and I have those modules:</p>
  
  <h2>Java (this example only receive from HTML/JSP)</h2>
  
  <pre class="lang-java prettyprint-override"><code>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 loginServlet extends HttpServlet {
      public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          response.setContentType("text/html");
          PrintWriter out = response.getWriter();
          String userName = request.getParameter("userName");
          String password = request.getParameter("password");
          out.println("&lt;html&gt;");
          out.println("&lt;body&gt;");
          out.println("Hello " + "  " + userName + "welcome to my blog");
          out.println("Your password is : " + "  " + password + "&lt;br&gt;");
          out.println("&lt;/body&gt;&lt;/html&gt;");
      }
  }
  </code></pre>
  
  <h2>HTML/JSP</h2>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang ="pt-br"&gt;        
     &lt;head&gt;
        &lt;title&gt; loginServlet &lt;/title&gt;
        &lt;meta http-equiv = ”Content-Type” content=”text/html; charset=UTF-8”&gt;
        &lt;link rel="stylesheet" type="text/css" 
              href="c:/java/html/css/estilo.css"/&gt;                     
     &lt;/head&gt;
  
     &lt;body&gt;
        &lt;h2&gt; Login Page &lt;/h2&gt;
  
        &lt;p&gt;Please enter your username and password&lt;/p&gt;
  
        &lt;form method="GET" action="loginServlet"&gt;
           &lt;p&gt; Username &lt;input type="text" name="userName" size="50"&gt; &lt;/p&gt;
  
       &lt;p&gt; Password &lt;input type="text" name="password" size="20"&gt; &lt;/p&gt;
  
       &lt;p&gt; &lt;input type="submit" value="Submit" name="B1"&gt; &lt;/p&gt;
        &lt;/form&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h2>WEB.XML</h2>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
  &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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
      version="2.4"&gt;
  
      &lt;display-name&gt;loginServlet&lt;/display-name&gt;
      &lt;description&gt;
          This is a simple web application with a source code organization
          based on the recommendations of the Application Developer's Guide.
      &lt;/description&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;loginServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;java.loginServlet.WebContaint.WEB-
                         INF.classes.loginServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;loginServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/loginServlet&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt; 
  </code></pre>
  
  <h2>Paths and folders</h2>
  
  <ul>
  <li><p><code>loginServlet.class</code> is in <code>C://java/loginServlet/WebContaint/WEB-INF/classes/</code></p></li>
  <li><p><code>loginServlet.jsp</code> is in <code>C://java/loginServlet/WebContaint/</code></p></li>
  <li><p><code>web.xml</code> is in <code>C://java/loginServlet/WebContaint/WEB-INF/</code></p></li>
  <li><p><code>loginServlet.war</code> is in <code>C:\Program Files\Apache Software Foundation\
  Tomcat 7.0\webapps</code></p></li>
  </ul>
  
  <p>When I try to call in my Chrome, using a localhost (<a href="http://localhost:8080/loginServlet" rel="nofollow noreferrer">http://localhost:8080/loginServlet</a>), I receive a 404 Error.</p>