• 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

Auto display uploaded image

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
We don't have time for this. We've gotta save the moon! Or check this out:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic