struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Collin VanDyck <col...@hannonhill.com>
Subject Problem validating multipart form data
Date Wed, 02 Nov 2005 01:56:47 GMT
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message