Search code examples
jsfrichfacesmyfaces

How to display image in jsf and onclick provide a file upload (to replace)


I would like to display an image on my web page and provide the user the ability to click it and upload another image to replace it.

Either myfaces or Richfaces works.. (I know tomahawk has some solution but i'm wondering if that's the only solution. The least libraries I use the better..)

Thanks!


Solution

  • You can use something like rich:fileUpload (MyFaces has also got a component for that). Handle file upload on the server side and replace the target file. A more sofisticaded solution would be with saving images as blobs in a database.