• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beanutils.populate error with file upload control

 
Rahul Vhatkar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,
could you put some code, so that we could understand,
also, are you using struts 2 or struts 1?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic