[jboss-user] [JBoss Seam] - Re: Help on s:filleupload

xigua do-not-reply at jboss.com
Thu Mar 8 17:29:26 EST 2007


"stu2" wrote : It looks like you're reading in the file even if one wasn't selected for uploading.  In my file upload bean I check to see if a file was actually uploaded.  If not, don't read it in.  Here's how it looks for me:
  | 
  | 
  | 
  |   |     	if (uploadFile == null) {
  |   |         	error("Hmm.  uploaded file data is null!");
  |   |     		return;
  |   |     	}
  |   | 
  | 
  | Could this be your problem?

I don't think so since the NPE happens in org.jboss.seam.ui.FileUpload.decode 
Maybe I misunderstood. 

So I have a backing bean which has a InputSteam field and there are getter and setter for it. So on the front end, I use <s:fileUpload data="#{backingbean.filedata}" />. My understanding is that if user select the file, then the file will be uploaded and set to the InputStream field otherwise set it to null, I didn't try to read the file at all. It seems to me that once I use fileUpload component and bind it to a field of the backing bean, the seam component will try to read the file no matter whether there is file selected?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026445#4026445

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026445



More information about the jboss-user mailing list