DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12884>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12884

Multipart/form-data post doesn't process URL parameters

           Summary: Multipart/form-data post doesn't process URL parameters
           Product: Struts
           Version: 1.1 Beta 2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: File Upload
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I'm having a weird problem with Struts 1.1b1. I have a
multipart/form-data form that uses an action that has
parameters such as : 

/MyAction.do?param1=value1&param2=value2

I have a bean that has properties param1 and param2.
When using the multipart encoding these values are
never set. 

Looking through the Struts code it seems that we do a
FileUpload.parseRequest to get the items in a
multipart, but it seems we NEVER handle the URL query
parameters as a simple request.getParameter would do
it. This is specific to the File Upload request processor. In the regular case 
we do take the whole Servlet API map that contains URL parameters to populate 
beans.

Here are more details and examples of how to build a test case for this : 

<form action="/Action.do?test1=value1&test2=value2"
enctype="multipart/form-data">

The ActionForm looks like this : 

public class MyForm extends ActionForm {

  private String test1;
  private String test2;

  public void setTest1(String test1) {
    this.test1 = test1;
  }

  public String getTest1() {
    return test1;
  }

  public void setTest2(String test2) {
    this.test2 = test2;
  }

  public String getTest2() {
    return test2;
  }

  ... other properties for other input types included
  ... in the form.

}

What happens is that setText1 and setText2 are never
called because the URL parameters are totally ignored
in the case of a multipart/form-data encoding type !
I believe it's a problem with the list of items that we only get back
from FileUpload.parseRequest. We should combine the
items list with the request parameters in order to
really get all the content that has been sent in the
request, not just the content of the <input> forms.

Also, note that the request.getParameter() calls do
return values for "test1" and "test2" in the case of
multipart/form-data, so I believe Struts should follow
the Servlet's API behavior here.

The tests were done using Apache Tomcat 4.0.1 and Struts 1.1b2

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

Reply via email to