Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

error during uploading files - no parametres in request

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic