Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Upload

 
rudresh kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have been trying to upload a file using commons File Upload.

There are no compilation Errors.

Following is the code on struts action



The result of the last line is "false"; due to which the program does not proceed further. Would like to know the reason of why it is "false".

Following line is included in the jsp


Thanks
 
rudresh kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FYI, the same code works fine with normal jsp (non struts code)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you compared the HTML rendered by Struts to see where the difference lies?
 
rudresh kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi

Following are the html rendered on the browser

Struts



jsp



Struts actions class is blank, it just routes back to 'uploadsuccess.jsp".

I had printed the following on 'uploadsuccess.jsp'

Iterator itr = items.iterator();
out.println("<h1>"+itr.hasNext()+"</h1>");


It is True for jsp page and False for struts page. Basically works fine for normal jsp, but fails for struts based jsp

Thanks

 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this help?
 
rudresh kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

The code in the above link is same as my code, but the behaviour is still the same. Does not work for Struts code

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic