• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Upload not working as expected with javascript,ajax, struts

 
krishna chaitanya praturi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application where I have to upload files in a dynamic table. My code is as follows:

JSP code:




JS code:




MasterBean.java:




FileUpload.java




My Problem is , This code works sometimes and does not on other times.

1.When it works.. it uploads the first file and then when I retry uploading another file , it gives the details of the first file and uploads the first file again. The second file is not getting uploaded.

2.When it does not work , It gives a null pointer exception. and getMyFile() shows null in the console.

Can anyone please let me know what is wrong with my code? and explain me exactly what is happening here?? Thank You in Advance!

note: working in eclipse galileo.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the line I am pointing out in the code below supposed to do?




Eric
 
krishna chaitanya praturi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Yeah .. you can actually remove that line.. I used it for debugging purposes
 
krishna chaitanya praturi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have changed my form bean to this:



Now, I am getting this error in my console:



Can anyone please find out what is the problem? Thank You.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic