Access external image RichFaces

0

I have a giant problem at work, hehe.

It turns out that we work with RichFaces, JSP, Java. I must access and show in JSP an image that is hosted in the root of the hard drive, but I can not find the way to place the correct route and it does not show it to me.

I am using the tag "graphicImage" in which I place the path where the image "value=" C: /mnt/SoftwareAndDeve/SOFT/IMAGES/Frases.png "" but this does not work and I tried everything with this route. I remove the C: / or placing ... before, everything and still does not show me the image.

I require this since it is an image that must be constantly changed and if I do not do this, I would have to mount version to production constantly.

I hope to make myself understood and forgive my little knowledge about it.

I appreciate your help: D

    
asked by Camilo Gutiérrez Castrillon 05.04.2018 в 17:56
source

1 answer

1

The easiest thing would be to add the folder as a "virtual context" of the servletcontainer you are using. In Tomcat, it's about adding a new% <Context> to server.xml

<Context docBase="/path/to/images" path="/images" />

and in Glassfish it's a matter of adding alternatedocroot to glassfish-web.xml

<property name="alternatedocroot_1" value="from=/images/* dir=/path/to" />

See the servletcontainer documentation for more details. Ultimately, they must be accessible through a normal URL so you can use, for example:

<p:graphicImage value="/images/#{image.imageName}" />

Other forms include the use of PrimeFaces StreamedContent API or homegrowing to servlet. (Translate).

See also (Translate):

answered by 05.04.2018 в 18:08