tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karthikeyan Chidambaram Ramabhatla" <karthik_c7...@rediffmail.com>
Subject Regarding struts file upload
Date Wed, 16 Jul 2003 09:23:26 GMT
Dear Sir,

With reference to the file uploading example int following link
http://jakarta.apache.org/struts/faqs/actionForm.html

I have a question.

I have an almost similar example to run, using a String to 
retrieve the file name instead of FormFile object.

However I am facing the following problem.

My form tag is like this.

<html:form action="/Upload" name="uploadForm" 
type="xyz.UploadForm">

In my Action file's execute() method, I try to parse the uploaded 
file using MultipartParser.

However the parser does not happen since the contentType is not 
multipart/form-data.

If I change the tag to include the enctype as follows
<html:form action="/Upload" name="uploadForm" 
type="xyz.UploadForm" enctype="multipart/form-data">
I get the following error



javax.servlet.ServletException: BeanUtils.populate
 	at 
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:954)
 	at 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:795)
 	at org.

followed by

root cause

java.lang.IllegalArgumentException: argument type mismatch
 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 	at


Can I know what is the probable cause of this ?
Is adding the enctype tag in the form tag not the only requirement 
?

If I dont use struts, I dont face such a problem and the file gets 
uploaded.

Here are the relevant tags in my struts-config.xml

     <form-bean name="uploadForm"
      	type="xyz.UploadForm"/>


   <action-mappings>

 	<action path="/Upload"
 		type="xyz.UploadAction"
 		name="uploadForm"
 		scope = "request"
 		input="/Upload.jsp">
 		<forward name="success" path="/UploadSuccess.jsp"/>
 		<forward name="failure" path="/Error.jsp"/>
 	</action>


</action-mappings>

Regards,


C. Karthikeyan.



___________________________________________________
Click below to experience Sooraj R Barjatya's latest offering
'Main Prem Ki Diwani Hoon' starring Hrithik, Abhishek
  & Kareena http://www.mpkdh.com


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


Mime
View raw message