| Author |
Auto display uploaded image
|
MohamedAhmed Ibrahim
Greenhorn
Joined: Jul 21, 2005
Posts: 12
|
|
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
Joined: Jun 25, 2001
Posts: 12513
|
|
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.
|
One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
|
 |
MohamedAhmed Ibrahim
Greenhorn
Joined: Jul 21, 2005
Posts: 12
|
|
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
Joined: Jun 25, 2001
Posts: 12513
|
|
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.
|
 |
 |
|
|
subject: Auto display uploaded image
|
|
|