Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Auto display uploaded image

 
MohamedAhmed Ibrahim
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JSF2 and Tomcat 7
I want to upload an image and display it in the same page as a thumbnail how can i do it ?
I tried using primefaces it uploads the image but it never display it till i refresh the application because i upload it to the root of the application.
Thank you for your help
 
Tim Holloway
Saloon Keeper
Posts: 18365
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope that when you say "upload to the root of the application", you do not mean that you're uploading the image into the WAR directory. You should never write files into a WAR. Or into any of the directories belonging to your webapp server. Always upload into a directory that's external to your server and applications.

To get an image to upload and display, you have to re-render the part of the page that the image is displayed in. If PrimeFaces is using AJAX to manage its file upload, that means that you'll need to have to add AJAX support for re-rendering.

I'm not familiar with Primefaces, so I can't supply details, but it's usually not difficult.
 
MohamedAhmed Ibrahim
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Tim ,
Do you know any way of using ajax in such situation?
I tried to upload the images to another directory but i failed to make the server know the path of the image . I am using tomcat 7
 
Tim Holloway
Saloon Keeper
Posts: 18365
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The server neither knows nor cares about uploaded files. Only your application does.

I'm afraid that my knowledge on image display via AJAX isn't going to be of much use. I've been using RichFaces for that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic