This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

How to retrieve textbox value in multipart form

 
Ranch Hand
Posts: 37
C++ Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had research about this, and their answer is

But I always get null value by using this method.
Any advise?

Index.jsp


upload.jsp


Whenever I am perform the Submit button, the image is uploaded but the txtDesc value always give me a null value.
Thanks for advanced.
 
Marshal
Posts: 67289
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot use the getParameter family of methods with multipart forms.

Are you using a 3rd-party library to process the uploaded form?
 
gah hon
Ranch Hand
Posts: 37
C++ Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You cannot use the getParameter family of methods with multipart forms.

Are you using a 3rd-party library to process the uploaded form?





I am using this kind of method to handle the uploaded form as well as the file uploaded.
How to upload file in JSP

What's the any other advise for retrieving the textbox value?
 
Bear Bibeault
Marshal
Posts: 67289
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, don't do it yourself. See the JspFaq for libraries that will do it for you. See https://coderanch.com/how-to/java/FileUpload
 
gah hon
Ranch Hand
Posts: 37
C++ Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Yes, don't do it yourself. See the JspFaq for libraries that will do it for you. See https://coderanch.com/how-to/java/FileUpload



All right, I had apply the approach of using Apache Common FileUpload to retrieve the value of the textbox.
So, I did download and paste the .jar file into the Project's lib and apply the import statement.



Then I am trying the retrieve the value from the textbox.


P/S: Variable desc is declared as global variable.

And the error I got once I execute the program.


Thanks for the future advise.
 
Bear Bibeault
Marshal
Posts: 67289
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have not included all the necessary jar files. The error messages tell you what classes are missing.
 
gah hon
Ranch Hand
Posts: 37
C++ Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You have not included all the necessary jar files. The error messages tell you what classes are missing.



Thanks for the guide.
In order to use Apache Common Fileupload approach.
Common-File.Jar & Common-Io.jar must included.
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!