title: Dynamic dropdown returns a null from jsp
body: <p>I have written a dropdown list which is populated by the database. This is my dropdown code in JSP file.</p>
  
  <pre><code> &lt;td&gt;Category:&lt;/td&gt;
   &lt;%
    try {
        dbConnect dbConnect = new dbConnect();
        Connection currentCon = dbConnect.Connect();
        System.out.println("Connection sucess");
        String sql = "SELECT * FROM categories";
        PreparedStatement ps = currentCon.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();%&gt;
   &lt;td&gt;&lt;select name="category" class="form-control" required&gt;
        &lt;%
          while (rs.next()) {
             String cname = rs.getString("category_name");
             String id = rs.getString("category_id");
             System.out.println(id);
        %&gt;
        &lt;option value="&lt;%= id%&gt;"&gt;&lt;%= cname%&gt;&lt;/option&gt;
        &lt;%
          }
        %&gt;
        &lt;/select&gt;
        &lt;%
        } catch (SQLException sqe) {
              out.println(sqe);
        }
   %&gt;
   &lt;/td&gt;
  </code></pre>
  
  <p>The relevant servlet code is;   </p>
  
  <pre><code>String id = request.getParameter("category");
  </code></pre>
  
  <p>In the sout of the dropdown in JSP it prints all the IDs in the category. But when it comes to the servlet it returns a null. How to resolve this issue?</p>