title: Java post form in JSP, get parameter in servlet returns NULL
body: <p>I'm having a problem with a simple Java form submission.</p>
  
  <p>I have my login.jsp</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;The best login page in the world&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
  
          &lt;h1&gt;Connexion&lt;/h1&gt;
          &lt;form id="asdasd" name="coucou" method="post" action="doLogin"&gt;
              &lt;input type="text" name="user_email" /&gt;
              &lt;input type="password" name="user_password" /&gt;
              &lt;input type="submit" name="asd" value="Se connecter" /&gt;
  
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>my web.xml specifiying that doLogin in infact the servlet loginServlet</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;
          &lt;param-value&gt;Development&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;loginServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.courses.web.servlet.loginServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&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;servlet-mapping&gt;
          &lt;servlet-name&gt;loginServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/doLogin&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;
              30
          &lt;/session-timeout&gt;
      &lt;/session-config&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;faces/index.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>And my loginServlet.java</p>
  
  <pre><code>public class loginServlet extends HttpServlet {
  
  
      protected void processRequest(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          response.setContentType("text/html;charset=UTF-8");
          try (PrintWriter out = response.getWriter()) {
  
          }
      }
  
      @Override
      protected void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          processRequest(request, response);
      }
  
      @Override
      protected void doPost(HttpServletRequest req, HttpServletResponse response) {
          String username = req.getParameter("user_email");
          String password = req.getParameter("user_password");
  
          Console console = System.console();
          console.printf("mail : %s\npassword: %s\n", username,password);
  
      }
  
      @Override
      public String getServletInfo() {
          return "Short description";
      }
  
  }
  </code></pre>
  
  <p>Nothing really complicated but the variable that I get from getParameter are always NULL and I don't know why.</p>
  
  <p>What am I doing wrong ?</p>