This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

how to get the request parameter in a Post method of form enctype=multipart/form-data

 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using <form enc-type=multipart/form-data method="post">
and in the doPost() method of servlet , i am not able to get the request parameters which are used for the jsp page. But it works fine for the Get() method. Is there any specific way to get request parameters, in Post() method once we used multipart/form-data as enc-type ???

thanks
indu
 
Marshal
Posts: 67343
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you processing the multi-part request on the server? With a 3rd-party library?
 
indu yeturu
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not using any thirdparty library. Is it needed ?
 
Bear Bibeault
Marshal
Posts: 67343
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you are parsing the multi-part request using your own code?
 
indu yeturu
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Bear , Iam parsing multipart request in one jsp form using POST method, and the receiving servlet will not be able to get the parameters I specified in the form. If I am using the wrong way, please let me know what is the correct way and how to use that third party library..

thanks
indu
 
Bear Bibeault
Marshal
Posts: 67343
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The POSTed parameters will be part of the multi-part request. Perhaps your parsing algorithm is not quite correct yet.

In any case, this is hardly an HTML question so I've moved this along to a more appropriate forum.
 
indu yeturu
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now i cleared my own way and am using commons-fileupload 1.2.1 library..
Still getting the

"java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream.."

please can you send me a solution ?

thanks
indu
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The no class def found error is because at runtime the jar file is not being found.
Place the jar file in the classpath
( web-inf/lib folder of your application )

This will eliminate the no class def found error

Then you can check if the posted data is available to ou.
 
indu yeturu
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already placed it in the classpath..commons-fileupload.jar is sufficient or any other jars are also required?
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Library commons-fileupload.jar needs commons-io.jar

You also need to put commons-io.jar in your WEB-INF/lib

See Commons fileUpload page for more information.
[ September 02, 2008: Message edited by: Bupjae Lee ]
 
What's brown and sticky? ... a stick. Or a tiny ad.
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!