Refresh an uploaded image in JSF(to display)

2019-09-09 22:11发布

问题:

I'm developing a JSF application which has an image upload function. I'd like to display the uploaded image. The uploading works fine but when I delete the uploaded picture and upload a new one, the old one is displayed in the browser. I typed the link of the picture in the browser but I sill get the old one. I use the same file name and I would not like to change it. How could I refresh it. (without Javascript). I'm using Glassfish Server. (Redeplyoing the application I get the new picture but it isn't a solution for an online system ;)) Thank you.

回答1:

Redeplyoing the application I get the new picture

Don't store it in the deploy folder by getRealPath() and consorts. Store it outside the deploy folder.

See also:

  • Uploaded image only available after refreshing the page