dcsimg
multipart/form-data processing with struts
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   zugurt_zugurt
Posted On:   Friday, May 21, 2004 09:24 AM

Hi, I am migrating an old project to struts. In the old project I had a jsp which has a form with definition like and some text and file type inputs in it. In somejsp.jsp I take the request object and process it in a java class. In the following statements : ServletInputStream in = request.getInputStream(); byte[] bytes = new byte[512]; int i = in.readLine(bytes,0,512); i returns something about 45 and I process through it and there is no problem. When I migrate this to struts I made the main jsp, a form bean for it and an action for it. The form's definition is : in the form-bean, datatype of the file fields is Object(I am not sure if making this is true). In the forms    More>>

Hi, I am migrating an old project to struts. In the old project I had a jsp which has a form with definition like

			
		
and some text and file type inputs in it. In somejsp.jsp I take the request object and process it in a java class. In the following statements :
			
ServletInputStream in =
request.getInputStream();
byte[] bytes = new byte[512];
int i = in.readLine(bytes,0,512);

i returns something about 45 and I process through it and there is no problem.

When I migrate this to struts I made the main jsp, a form bean for it and an action for it. The form's definition is :

		
in the form-bean, datatype of the file fields is Object(I am not sure if making this is true). In the forms action I implemented the same statements above and I always get -1 for i. So I cannot process the ServletInputStream.

Can anyone help me about this problem....
thanks...    <<Less

Re: multipart/form-data processing with struts

Posted By:   Sean_Owen  
Posted On:   Friday, May 21, 2004 11:56 AM

Struts will do a lot of the work for you -- look into its FormFile class. If you use this in your ActionForm then you should be OK.
About | Sitemap | Contact