This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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.
An IDE is no substitute for an Intelligent Developer.
Joined: Jul 21, 2005
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