File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Jason Hunter's MultipartWrapper and Struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Jason Hunter Watch "Jason Hunter New topic

Jason Hunter's MultipartWrapper and Struts?

A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
Trying to use this lib to handle file uploading in my Struts app - has anyone else got this to work?

Reason I ask is the request object that get's passed to the Action "execute" method should be of type "MultipartWrapper" but actually it's "MultipartRequestWrapper"!

Will this work with Struts Action's & how do you get to the uploaded file? or do you have to use a servlet instead of an Action?

This is damm hard work!


Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Struts has it's own file upload helpers. If you just define a property of your form bean as type org.apache.struts.upload.FormFile with the same property name used in your <html:file> tag, Struts will automatically map the uploaded file to an instance of this class. There is an example of a file upload in the struts-examples.war file that comes with the Struts download. If you study it, you'll see how it's done.

Once you have a FormFile instance, you can use it's methods to read or write the uploaded file.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Jason Hunter's MultipartWrapper and Struts?
It's not a secret anymore!