When using URL encoded parameters, these parameters
dont occure in the Enumeration of getParameterNames()
of the MultipartServletRequest, but in the Enumeration
of getParameterNames() of the original HttpServletRequest.
Here some Example HTML and Java
----------------------------
<form name="login" enctype="multipart/form-data"
action="/servlet;jsessionid=70btl33qm1?urlparam=test"
method="post" target="_top">
<input name="text" value="test" />
<input type="hidden" name="action" value="upload" />
<input name="file" type="file" />
<input type="submit">
</form>
----------------------------
protected void doPost ( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
{
MultipartServletRequest msq = new
MultipartServletRequest ( request );
...
}
----------------------------
For this
request.getParameterNames() returns an Enumeration
containing:
{ urlparam }
while msq.getParameterNames() contains
{ action, text }
My current workaround is to but the URL encoded urlparm
also in a hidden input field.
Logged In: YES
user_id=140861
The Servlet 2.1 specification that Marsh was written for did
not speak to the handling of data from the query string and
the POSTed form if both were present, thus older servlet
containers were allowed to pick-and-choose how they wanted
to handle that situation. I chose the
least-common-denominator at that time.
Reviewing the Servlet 2.3 specification, it appears that
indeed the values from the query string and the POSTed body
are to be aggregated together. (Section 4.1, page 31.)
I will make this update this week.
- David