Martin,
I don't know if Terry got it working, but I don't see why he (or anyone)
couldn't keep it simple by using a CommonsMultiPartRequestWrapper's
getTextElements() or getAllElements() methods, liks so:
// Assuming wrapper is the initialized CommonsMultiPartRequestWrapper
Hashtable textElements = wrapper.getTextElements();
String paramOne[] = (String)textElements.get("One");
// OR .... (Note the String array in both examples)
Hashtable allElements = wrapper.getAllElements();
String paramOne[] = (String)allElements.get("One");
Both code works if you add it to the example code I uploaded Saturday:
www.mail-archive.com/[EMAIL PROTECTED]/msg87269.html
Regards,
David
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] Behalf Of Martin Cooper
Sent: Monday, November 24, 2003 6:03 PM
To: [EMAIL PROTECTED]
Subject: Re: getParameter() returns null on multipart requests
"Terry Brick" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
> When I submit a multipart form to my action I am
> unable to get use getParameter() on the request object
> to get my form field values. As I understand it
> struts is supposed to automatically create a
> MultipartRequestWrapper which allows you to do this
> for multipart requests...
> I've seen some postings regarding this, but I still
> don't understand what I need to do. I think there was
> some mention that MultipartRequestWrapper doesn't work
> right if you're not utilizing the ActionForm?
It still works, but it won't do as much for you behind the scenes. ;-)
>From within an Action, using getParameter() should still work for regular
(i.e. non-file) items, because the request object passed to the Action is
the wrapped request. If you're calling that method from somewhere else, it
may or may not work, depending on whether or not you have a wrapped request.
(In many places, you will not have a wrapped request, because the Servlet
2.2 spec does not permit such a thing, and Struts 1.x is Servlet 2.2
compatible.)
--
Martin Cooper
>
> I also tried instantiating my own
> MultipartRequestWrapper by doing "new
> MultipartRequestWrapper(request)". That doesn't solve
> the problem either.
>
> Any ideas? I'm using the latest nightly build (Struts
> 1.2).
>
> Thanks!
>
>
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]