This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getParameter() returning null

 
Swetha Raghavendra
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Thank you,
Swetha.




Commons file upload servlet:


 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Swetha Raghavendra
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot!! that worked
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic