I'm using the commons file upload servlet in my application and below is the HTML file. I want to retrieve all the form fields from the HTML file in the servlet below along with the file uploaded. I tried request.getParameter(), but this returns null. Am I doing something wrong? And I'm not sure why the while loop is executing only once. In my case, shouldn't the while loop run 7 times to get all the input fields? Can someone please help me out.
You probably can't use request.getParameter() with a multipart/form request, that's why you are getting null in the first three console print statements,correct me if I am wrong. 2nd problem is out.close(). You are closing the output stream inside while loop, so it prints the first field name value, output stream is closed, loop continues tries to print again but as the stream is closed leads to an exception.