Parameters parsed from the Multipart request are stored in the
MulitpartRequestWrapper. However before Struts forwards the request it
unwraps it, loosing those parameters. So when your validation fails
this happens when it forwards to your "input".

This can be resolved in a Servlet 2.3 environment (which is the
minimum for Struts 1.3.x) - but Struts 1.2.x has a minimum of Servlet
2.2.

Details in the following bug:

http://issues.apache.org/bugzilla/show_bug.cgi?id=17583

Niall


On 11/2/05, Collin VanDyck <[EMAIL PROTECTED]> wrote:
> Hello!
>
> I'm using struts-1.2.7.
>
> I have form that needs both file upload functionality as well as normal
> form fields interspersed on the same HTML page.  I'm using the built-in
> struts file upload utilities, so I create the form:
>
> <html:form method="POST" action="/entity/submitfile.act"
> enctype="multipart/form-data">
>    ...
> </html:form>
>
> If there are no errors, this approach works perfectly.  I correctly
> receive the file data submitted, if any, along with the normal form
> field values.
>
> However, if my ActionForm fails validation, when the resultant action
> gets called (specified by the input attribute) the request object
> contains no request data from my form.  My ActionForm, however,
> populates correctly.
>
> I understand that for multipart/form-data encoding types that the
> framework will wrap the normal request object in a
> MultipartRequestWrapper. Indeed, this is the case when this form
> submits.  The MultipartRequestWrapper does not contain any of my request
> parameters from the form.  I called MultipartRequestWrapper.getRequest()
> to get the original request that was wrapped to begin with, but it also
> does not have any of my request parameters.
>
> The strange thing is, is that if I convert the form to not be
> multipart/form-data encoded, and remove the file upload widget, it works
> perfectly, retaining request parameters even when validation fails.
>
> Any ideas on what I may be doing wrong? I feel like this is probably a
> common problem. I found some similar problems on the mailing list
> archives, but could not find any resolutions.
>
> many thanks
> Collin

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

Reply via email to