• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts 2 upload image problem

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic