File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Multipart form won't submit with Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multipart form won Watch "Multipart form won New topic

Multipart form won't submit with Struts

Tomas George

Joined: May 26, 2011
Posts: 1
I have a Struts 1.2 application that uses file upload in one of the pages. Before adding the `<html:file>` field and changed form type to `multipart/form-data` everything was ok. I was submitting the form through Javascript upon pressing a button. Now, with the input file in place and corresponding form type, when I press the button, the submit is not performed anymore. Nothing happens. Submission code is something like this:

myForm = document.getElementById('form1');
myForm.action = '/myproject/';

I removed the field and the `multipart/form-data` type and everything was fine again.

Then I just added `multipart/form-data` to the field and submit did not work again. I already spent several hours with this issue and I cannot find a solution. It seems really stupid and maybe you have an idea of what's going on.

I've installed live http headers plugin in Firefox and I noticed: - the form gets submitted (even though it will not call my Action class execute) -
the server returns HTTP/1.1 204 No Content Server: Apache-Coyote/1.1 X-Powered-By: Servlet 2.4; ....

Thank you.
I agree. Here's the link:
subject: Multipart form won't submit with Struts
It's not a secret anymore!