File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Android Security Essentials Live Lessons this week in the Android 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?
 
 
subject: Beanutils.populate error with file upload control
 
Similar Threads
Upload multiple files with separate submit buttons
Problem with file separator
Displaying file content in a jsp page
File Upload using html:file tag
could not setThe value in html:file