aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Jason Hunter Watch "Jason Hunter New topic
Author

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!

thanks

Harry
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.


Merrill
Consultant, Sima Solutions
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Jason Hunter's MultipartWrapper and Struts?