aspose file tools*
The moose likes Struts and the fly likes IllegalArgumentException using Struts FileUpload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "IllegalArgumentException using Struts FileUpload" Watch "IllegalArgumentException using Struts FileUpload" New topic
Author

IllegalArgumentException using Struts FileUpload

vikram nalagampalli
Ranch Hand

Joined: Oct 08, 2001
Posts: 91
Guys,
I have a formBean with the following instance variables
private String orderExtra3 = null;
private String orderExtra4= null;
private FormFile theFile = null;

JSP has the following

<html:file name="orderAddEditForm" property="theFile"/>

I get the following error when submit is clicked. Please let me know your thoughts



java.lang.IllegalArgumentException: Cannot invoke com.gv.cpm.customer.order.OrderAddEditForm.setTheFile - argument type mismatch
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1778)
org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:804)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
vikram nalagampalli
Ranch Hand

Joined: Oct 08, 2001
Posts: 91
Hi all,
Found the problem, it was because of not adding the following in the <html:form>

enctype="multipart/form-data"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IllegalArgumentException using Struts FileUpload