Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
indu yeturu
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
 
satish bodas
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?
 
Bupjae Lee
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic