In my project,in the production some how we are getting NullPointerException while uploading a file. To upload a file we are using <html:file property=""> struts tag and we are using FormFile as the property of the form. We are trying to simulate this issue in the local by using Chrome,internet explorer,safari,Opera and mozila. we are unable to simulate, but in production we are getting NullPointerException while getting the form property like below
public class MyForm
private FormFile myFile;
setter & getter
In Action we are saying
Here we are getting NullPointerException.
if we don't upload any file, in action for the "myForm.getMyFile()" its giving empty. But some how in some cases we are getting for the same(myForm.getMyFile()) null. we are thinking that some browsers are not supporting file upload. Can you help me. Its urgent Please
Campbell Ritchie wrote:Either myForm is null, or the getMyFile() method of myForm is returning null.
getMyFile() is null. Then how it is becoming null.. I am unable to know. Generally while using <html:file> and FormFile to upload a file, If we dont upload a file getFormFile() gives empty string,If we upload some thing getFormFile() gives file name what we have uploaded. In some case getFormFile() is returning null.If you know.. Please let me know
You got style baby! More than this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth