You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marc Dugger <ma...@socotech.com> on 2003/10/09 22:20:07 UTC

RE: NotSerializableException using FormFile [SOLUTION]

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:marc@socotech.com]
> Sent: Monday, October 06, 2003 1:49 PM
> To: struts-user@jakarta.apache.org
> 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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org