title: HTML form for login always returns null values in request parameters
body: <p>I don't know why am I stuck in something this simple, but I just cant get out of it. </p>
  
  <p>First the HTML file I am using</p>
  
  <pre><code>    &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Welcome Guest- Please Login&lt;/title&gt;
  
  &lt;script type="text/javascript"&gt;
  
  function validate() {
  
      username = document.getElementById("username").value;
      password = document.getElementById("password").value;
  
      if( username==null || username=="" ) {
          alert("Please enter a username");
          return false;
      }
  
      if( password==null || password=="" ) {
          alert("Please enter a password");
          return false;
      }
      return true;
  }
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;form action="login" method="POST"&gt;
      &lt;br /&gt;
      Name: 
      &lt;input type="text" name="username" id="username" /&gt;
      &lt;br /&gt;
      Password: 
      &lt;input type="password" name="password" id="password" /&gt;
      &lt;br /&gt;
      &lt;input type="submit" onclick="return validate()" /&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And the doPost() method of my servlet</p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
      UserLoginDAOImplementation usr = new UserLoginDAOImplementation();
  
      String username = request.getParameter("username");
      String password = request.getParameter("password");
  
      System.out.println(username + password);
      User u = usr.getPassword(username);
  
      if( u.getPassword().equals(password)) { // If password matches
  
          response.sendRedirect("images");
      } else {
          response.sendRedirect("invalid");
      }
  }
  </code></pre>
  
  <p>I have searched the internet for all kinds of queries but nothing works. I know there is the problem of enctype and all and I have tried that too along with numerous other experiments. Every time I run this, those print statements just print <code>nullnull</code> and null pointer exception is thrown. I am really really stuck with this. Please someone tell me what is wrong.</p>
  
  <p>I am using Eclipse Juno with Tomcat and other Java EE plugins.</p>
  
  <p>EDIT:</p>
  
  <p>Just like i suspected, problem was somewhere else entirely. I simply run my program today without even touching the previous code and it worked like a charm. I dont even know what the hell was wrong yesterday.
   I am new to eclipse and i am noticing such behavior from eclipse again and again since i started using tomcat. I had to restart eclipse to make it render changes i made in html files for which i would love to have a work around. I restarted eclipse several times with this problem but it was not working at all. 
  <strong>So can you please guide me with some tips to be remembered while working with web applications in eclipse...</strong></p>