wood burning stoves*
The moose likes Servlets and the fly likes problems with forms + multipart/form + servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "problems with forms + multipart/form + servlets" Watch "problems with forms + multipart/form + servlets" New topic
Author

problems with forms + multipart/form + servlets

Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Hi guys.
I have a jsp form with different things (checkboxes, input type, drop down menus, etc), and I also have a file option where the user can select a file from his/her computer.
The request goes to a servlet. After a while I noticed that when I type
String category = request.getParameter("category")
all the values returned are NULL
I also noticed that if I take out the encode type in the form (multipart/form), The values are not null anymore.
What's wrong?? I need to have the encode type in the form because I'm uploading that image in the server.
Any suggestions?
thanks


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The way data is organised when the encoding type is multipart/form is completely different to the regular encoding.
The problem is that the default decoding can't handle it and therefore returns nothing. You need to get something like the O'Reilly cos package (com.oreilly.servlet) to parse the data to extract the form data including files.
Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problems with forms + multipart/form + servlets