You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Turner Benjamin <Be...@cronos.be> on 2004/02/11 09:34:08 UTC

multipart problem

hello,

i have a problem with a multipart form and request parameters.

one of my forms uses a file upload to attach an optional image. after processing the image i forward to a second action in my action-mapping. in the first action all of my request parameters are readily available. however in the second action, all my request parameters seem to have disappeared and are no longer available. if i get rid of the enctype="multipart/form-data" option in my <html:form ..> declaration, the parameters appear without any problem at all (in the second form).

i read in the struts-dev mail archive there had already been some problems regarding file upload - is this related to that?

thanks,

Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: multipart problem

Posted by Joe Germuska <Jo...@Germuska.com>.
At 9:34 AM +0100 2/11/04, Turner Benjamin wrote:
>hello,
>
>i have a problem with a multipart form and request parameters.
>
>one of my forms uses a file upload to attach an optional image. 
>after processing the image i forward to a second action in my 
>action-mapping. in the first action all of my request parameters are 
>readily available. however in the second action, all my request 
>parameters seem to have disappeared and are no longer available. if 
>i get rid of the enctype="multipart/form-data" option in my 
><html:form ..> declaration, the parameters appear without any 
>problem at all (in the second form).

When you forward to a second action, you re-invoke the entire request 
processing chain, which means that you get a new form object created, 
etc.  This is why you'll frequently see recommendations against 
"action chaining."  Of course, if you get rid of the form encoding, 
you won't be able to do file upload at all, so that's not

Are you sure that forwarding to a second action is the only way to 
process the data?  Perhaps you can rearrange things to avoid 
re-invoking the request processor.

Joe


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
       "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
             -- Jef Raskin

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org