aspose file tools*
The moose likes Struts and the fly likes Struts 2 upload image problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 upload image problem " Watch "Struts 2 upload image problem " New topic
Author

Struts 2 upload image problem

Robert Sacchi
Greenhorn

Joined: Jul 11, 2012
Posts: 5
Hi everybody!
I need to upload an image file using struts 2.
I just follow step by step the example in this site

but when I'm on action java class, I always get my upload variables NULL (in my case userImage, userImageContentType and userImageFileName).

I've copied "commons.fileupload-1.2.2.jar" and "commons.io-2.4.jar" into my WEB-INF/lib folder.
I try to change something to make it works, so here's my struts.xml:



The strange thing is that I get no feedback at all, no errors... I reach the success.jsp page but with userImage = null.
Maybe interceptors don't do their job.

Any help?

Thanks

Rob
Robert Sacchi
Greenhorn

Joined: Jul 11, 2012
Posts: 5
Does anyone could build a dynamic eclipse project, try the example I link and tell me if it works?
I'm sure I'm missing something, but I don't know how to find it.

Thanks

Rob
Robert Sacchi
Greenhorn

Joined: Jul 11, 2012
Posts: 5
sorry If I update this thread again, but I've discovered something probably useful.
I'm using Glassfish 3.1.2 as Server, and when I submit the form, the image is stored in this directory:

c:/glassifish3/glassfish/domains/domains/generated/jsp/MYPROJECT

That file is deleted after the action execution.
So Struts 2 doesn't see that directory...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 upload image problem