Two Laptop Bag
The moose likes Servlets and the fly likes error during uploading files - no parametres in request Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "error during uploading files - no parametres in request" Watch "error during uploading files - no parametres in request" New topic
Author

error during uploading files - no parametres in request

max afinogenov
Greenhorn

Joined: Jun 10, 2007
Posts: 9
Hi guys.
I have a simple html page

with 2 text fields and 1 file field.
This is my simple servlet:
After sending request, this servlet shows, that it hasn't received any param. Answer page is
<html>
</html>
But if I use
/*ServletInputStream in = request.getInputStream();
int i = in.read();
while (i!=-1) {
pw.print((char)i);
i=in.read();
}
pw.close();*/
then i see all the HTTP request (in the answer page). I have also tried to get params using request.getParameter("..."), but the result was the same.
When i dont use tag enctype="multipart/form-data", all is ok (of course, no file was uploaded). Browser is mozilla.
Applications .war file is deployed using weblogic (because its a test of interface of greater application).
Can you help me with this problem, please?
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Max,

it's true: if you upload a file, you can't use request.getParameter(...) anymore.

I suggest you have a look at The Commons FileUpload package (see http://commons.apache.org/fileupload/)

Herman
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: error during uploading files - no parametres in request
 
Similar Threads
Help me
File Upload using Jsp and servlets...
PrintWriter's println not working properly for me
Uploading Excel spreadsheet into JSP
File Uploading using Jsp and Servlets.