Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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: 67256
170
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: 67256
170
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: 67256
170
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.
 
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!