title: request.getParameter getting java.lang.NumberFormatException: null
body: <p>I have a dropdown menu which pulls data from a SQL table. Everything works fine and I'm able to select the value and submit the form.  However, my scriptlet gives NULL exception when I convert the value from String.  What am I doing wrong?</p>
  
  <p>testCars.jsp</p>
  
  <pre><code>&lt;form method=post action=“testCars.jsp"&gt;
  &lt;div class="cell"&gt;
          Select CarID
          &lt;div class="input-control select mutiple full-size"&gt;
              &lt;select id=“carID” name=“carID” onchange="listCarIDFromDatabase();”&gt;
              &lt;option selected disabled&gt;--SELECT--&lt;/option&gt;
              &lt;%
              ArrayList&lt;Integer&gt; result = carDAO.getCarID(Integer.parseInt(id));
              for (int r: result){
                  out.println("&lt;option value='" + r + "'&gt;" + r + "&lt;/option&gt;");
                    request.setAttribute("r", r);
              }
              %&gt;
              &lt;/select&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>The input returncarID is populated based on AJAX success onchange="listCarIDFromDatabase();</p>
  
  <pre><code>   &lt;button class="button primary" type="submit"&gt;Generate&lt;/button&gt;&lt;/form&gt;
     &lt;input name=“returncarID” id=“returncarID”&gt;   
  
  
  &lt;%
  //Scriptlet gets the value of the dropdown in next line, but when I convert to Int it is NULL
  String y = request.getParameter(“returncarID”);
  out.println(y);  &lt;——Prints out value here 
  
  int x = Integer.parseInt(y);
  out.println(x); &lt;———Null Exception here
  
  
  %&gt;
  </code></pre>