• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

multipart/form-data and request.getAttribute.

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
When ever i upload a file, i use encryption type as multipart/form-data in the form. But that way the form bean isn't get populated and the request.getParameter do not work. But by using request.getAttribute i am able to get the values in form. Why is this so?? (Isn't struts have anything in place to populate form beans through reflection when encryption type is multipart/form-data?)
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've written several upload JSPs using Struts and they populate the form bean just fine. The trick is that you have to define the file to be uploaded as type org.apache.struts.upload.FormFile and use the <html:file> tag in the jsp.

There is an example of a file upload in the struts-examples.war file that comes with the download. I'd suggest carefully studying their example to see how it's done.
[ February 03, 2006: Message edited by: Merrill Higginson ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic