We are having some trouble with multipart uploads and validation. A similar problem was described in: http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=740076
Our problem is an attempt to validate a form that includes a file upload. Our ActionForm successfully returns the correct set of ActionErrors when a field is missing, but then provides the following exception when it tries to display the form again ('returnto' is one of our hidden form fields):
javax.servlet.jsp.JspException: No parameter returnto was included in this request
We've traced through the source code and determined that a MultipartRequestWrapper is being created around our HttpServletRequest when we perform a file upload via multipart/form-data. This MultipartRequestWrapper, while it contains the original HttpServletRequest, handles parsing and storing of the request parameters on its own. This is helpful, indeed, except that when the RequestProcessor forwards the request to another action (such as after validation), it does not forward the MultipartRequestWrapper, but the original HttpServletRequest, which was never populated with any parameters!
The original, never-populated HttpServletRequest is unwrapped on line 1058-1060 of org.apache.struts.action.RequestProcessor, and forwarded on the chain via RequestDispatcher.forward(). Naturally, this causes the next step in the chain (sending back a form with errors) to fail, since it relies on the missing parameters to populate the form fields.
Our current workaround is to utilize JavaScript to append the request parameters to the form action string before submitting it, but we'd prefer for the HttpServletRequest to be populated, if at all possible.
Though the J2EE spec does not indicate setParameter() as one of its methods, does anyone know if there is any way "behind the scenes" to get this request object populated? Or, would it be possible to pass the MultipartRequestWrapper back as-is?
Thanks for any insight,
Ben Cox (&& Tim Ruppert)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
