aspose file tools*
The moose likes Struts and the fly likes Beanutils.populate error with file upload control Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Beanutils.populate error with file upload control" Watch "Beanutils.populate error with file upload control" New topic
Author

Beanutils.populate error with file upload control

Rahul Vhatkar
Greenhorn

Joined: Aug 24, 2009
Posts: 9
I have following code in my jsp:

<html:file property="theFile" size="40" accept="text/plain"/>

I also have setters and getters in my form bean:

public FormFile getTheFile() {
return theFile;
}
public void setTheFile(FormFile theFile) {
try {
this.theFile = theFile;
} catch(Exception e) {
System.out.println("error " + e);
}
}

But when I submit the form, I get Beanutils.populate error.
javax.servlet.ServletException: BeanUtils.populate

When I remove the html:file control from the jsp, then it works fine.

Any ideas?
Rahul Vhatkar
Greenhorn

Joined: Aug 24, 2009
Posts: 9
The BeanUtils error goes away when I add enctype="multipart/form-data" to my html:form tag in the jsp.

But the control does not go to the action class which should be called when the form is submitted. Instead it goes back to the previous jsp.

Can anybody please help?
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

Hi Rahul,
could you put some code, so that we could understand,
also, are you using struts 2 or struts 1?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Beanutils.populate error with file upload control