my dog learned polymorphism*
The moose likes Other Open Source Projects and the fly likes File Upload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "File Upload" Watch "File Upload" New topic
Author

File Upload

rudresh kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 83
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

Joined: Jan 04, 2006
Posts: 83
FYI, the same code works fine with normal jsp (non struts code)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Have you compared the HTML rendered by Struts to see where the difference lies?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
rudresh kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 83

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
Marshal

Joined: Mar 22, 2005
Posts: 41079
    
  43
Does this help?


Ping & DNS - my free Android networking tools app
rudresh kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 83
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Upload
 
Similar Threads
request.getParameter() returns null
File upload
getting nullPointerException on line upload.parseRequest(request);
File upload issues
upload.parseRequest(request); giving null.