This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

How to retrieve textbox value in multipart form  RSS feed

 
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: 67191
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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: 67191
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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 http://www.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 http://www.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: 67191
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
 
You may have just won ten million dollars! Or, maybe a tiny ad.
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!