1.  Create custom MultipartRequestHandler
("MyCustomMultipartRequestHandler") by extending
org.apache.struts.upload.CommonsMultipartRequestHandler.
2.  Create inner, private class in MyCustomMultipartRequestHandler that
implements FormFile and Serializable.  I simple copied all the methods from
the inner class CommonsFormFile in CommonsMultipartRequestHandler.
3.  Override addFileParameter(FileItem item) in
MyCustomMultipartRequestHandler to use your custom handler:
        protected void addFileParameter(FileItem item) {
        FormFile formFile = new MyCustomMultipartRequestHandler(item);

        getFileElements().put(item.getFieldName(), formFile);
        getAllElements().put(item.getFieldName(), formFile);
    }
4.  Add new 'controller' entry in struts-config.xml:
        <controller contentType="multipart/form-data;charset=UTF-8"
              multipartClass="your.package.MyCustomMultipartRequestHandler"
              debug="9" />


> -----Original Message-----
> From: Marc Dugger [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 06, 2003 1:49 PM
> To: [EMAIL PROTECTED]
> Subject: NotSerializableException using FormFile
>
>
> I've set the scope of my form to 'session' to support a "wizard" process.
> The form defines a property of type
> org.apache.struts.upload.FormFile.  This
> work fine until I set 'validate = true' on my action mapping.  It appears
> that
> org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile
> does not implement Serializable.  Has anyone run into this and
> what did you
> do to get around it?  Thanks in advance.
> ---
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/2003


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to