This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Websphere and the fly likes request.getParameter() returning null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "request.getParameter() returning null" Watch "request.getParameter() returning null" New topic
Author

request.getParameter() returning null

Swetha Raghavendra
Greenhorn

Joined: Jun 12, 2010
Posts: 5
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

Joined: Jan 08, 2009
Posts: 1449
    
    6

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.


Swastik
Swetha Raghavendra
Greenhorn

Joined: Jun 12, 2010
Posts: 5
Thanks a lot!! that worked
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: request.getParameter() returning null
 
Similar Threads
How to store a particular data into project file
problem with upload file using common file upload servlet
take in file from client machine
Uploading a file by parsing request
Unable to upload file using Swing and Servlets to Server