title: html form processing in java servlet
body: <p>I'm building a java servlet to respond to some HTML form. Here is the simple test form:</p>
  
  <pre><code> &lt;FORM action="http://somesite.com/prog/adduser" method="post"&gt;
      &lt;P&gt;
      &lt;LABEL for="firstname"&gt;First name: &lt;/LABEL&gt;
                &lt;INPUT type="text" id="firstname"&gt;&lt;BR&gt;
      &lt;LABEL for="lastname"&gt;Last name: &lt;/LABEL&gt;
                &lt;INPUT type="text" id="lastname"&gt;&lt;BR&gt;
      &lt;LABEL for="email"&gt;email: &lt;/LABEL&gt;
                &lt;INPUT type="text" id="email"&gt;&lt;BR&gt;
      &lt;INPUT type="radio" name="sex" value="Male"&gt; Male&lt;BR&gt;
      &lt;INPUT type="radio" name="sex" value="Female"&gt; Female&lt;BR&gt;
      &lt;INPUT type="submit" value="Send"&gt; &lt;INPUT type="reset"&gt;
      &lt;/P&gt;
   &lt;/FORM&gt;
  </code></pre>
  
  <p>On the server side I get the HttpRequest alright. But when I get the parameters like this:</p>
  
  <pre><code>@Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
          throws ServletException, IOException {
      String firstName = req.getParameter("firstname");
      String lastName = req.getParameter("lastname");
      String sex = req.getParameter("sex");
      String email = req.getParameter("email");
  
  }
  </code></pre>
  
  <p>Only the "sex" is ok. I've been at this for hours without understanding why "sex" is different from the rest. All other parameters are null. Ok it's the only "radio" type but is there a special way to get the parameters for the others?</p>
  
  <p>Thank you!</p>