title: Multipart/form-data how to get parameter hidden
body: <p>I 'm working on a web application. I have my jsp with enctype="multipart/form-data" and when I submit my request, I am unable to get the request parameters in servlet.</p>
  
  <p>The getParameter() calls will all return null. The question is how can overcome this problem?</p>
  
  <p>When it 's not enctyped, this code works fine. I know that this has been asked many times, but I did not find any straight answer</p>
  
  <p><strong>JSP</strong></p>
  
  <pre><code>&lt;form action="upload" method="post" enctype="multipart/form-data"&gt;
                  &lt;input type="file" name="uploadfile[]" id="uploadfile" size="50" multiple="true" /&gt;
                  &lt;br/&gt;&lt;br/&gt;
                  &lt;input type="hidden" name ="e_id" value= &lt;%=userBean.getEid%&gt; /&gt;
                  &lt;input type="hidden" name ="Uid" value= &lt;%=userBean.getUid()%&gt; /&gt;
                  &lt;input type="submit" name ="button1" value="Upload" /&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p><strong>Servlet</strong></p>
  
  <pre><code>@Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
  {
  
      int e_id =0;
      String uid = null;
  
      HttpSession session1 = request.getSession(true);    
      if(ServletFileUpload.isMultipartContent(request)){//process only if its multipart content
          try 
          {
            List&lt;FileItem&gt; multiparts = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
            for(FileItem item : multiparts)
            {
                if(!item.isFormField())
                {
                      String name = new File(item.getName()).getName();
                      item.write( new File(UPLOAD_DIRECTORY + File.separator + name));
  
                      e_id = Integer.parseInt(request.getParameter("e_id"));
                      uid = request.getParameter("Uid");
                }
                else {}
  ...
  </code></pre>