File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problems with forms + multipart/form + servlets

 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic