Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

why can't use request.getParameter when jsp form's enctype is "multipart/form-data"

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i use oreilly's com.oreilly.servlet.MultipartRequest for upload file ,and the code was write in a struts action:

in a jsp,the code is:



now i need refresh that jsp,because there is a "select" in jsp,when use "select",a javascript function was invoke.
and the code is :


i need use request.getParameter in this jsp,so i can remeber what i have selected last time..
how can i use request.getParameter when there is enctype in form.
because if there is enctype in form ,request.getParameter always return null.
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://coderanch.com/t/355356/Servlets/java/Servlets-HTML-forms-multipart-form
 
alex han
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks.but now i only want to know,when i use enctype="multipart/form-data" in jsp. how can i get the value that should return by request.getParameter
 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you'r eusing a 3rd-party library for the parsing, it usually has methods to get the parameters. If you're doing it yourself, it's tricky but doable. I did it with my upload web-app FileNabber - http://fn.filenabber.com

You should be able to look at the source of any of the 3rd-party libraries and see how they did it.

brian
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic