David Stemm wrote:
All,
I have a form that is doing a file upload and on the confirmation page after the upload I'm trying to get a request parameter using
the c:out tag. The tag doesn't seem to find the request param. I know the parameter exists - I can see it in the debugger.
The tag looks like this: c:out value=${param.action}/ and I tried this as well c:out
value=${param['action']}/. I believe the problem is because the form is setup to use multipart/form-data.
Any ideas on this? Thanks.
There is a note in the request.getParameter() JavaDocs that states:
If the parameter data was sent in the request body, such as occurs with
an HTTP POST request, then reading the body directly via
getInputStream() or getReader() can interfere with the execution of this
method.
You have probably used some package like FileUpload to handle the file.
This package would be using the getInputStream() to extract the
contents of the uploaded file (this is why you cannot access the
parameters normally). This package should also provide some method of
accessing any formfields or parameters that were passed.
FileUpload package:
http://jakarta.apache.org/commons/fileupload
(I haven't used this myself) It looks like you could use this in your
action to get a list of FileItems (some will be uploaded files which you
can save to disk, the others would be form fields).
When you find a form field, you could try adding it to the request using
request.setAttribute(), which should allow you to access it using c:out.
--
Jason Lea
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]