How to show image of server path to PrimeFaces p: graphicImage?

When I go back to the server path and show it in the tag p:graphicImage, images will not be displayed. Images are uploaded to the webbapp folder. The server path to the image looks like this: \\qbsserver\Test Folder\test\car.jpg.

<p:graphicImage value="\\qbsserver\Test Folder\test\\#{image.imageName}" />

How can I display them? I am using PrimeFaces 3.0 and JSF 2.0 in the Eclipse IDE.

+5
source share
1 answer

You make a conceptual mistake. This is not a server that somehow includes and sends the image along with the generated HTML output. This is a web browser that loads an image at the URL specified in <img src>when it encounters a tag <img>in HTML.

, URL-, , -, . , -, .

" " . , . Tomcat <Context> server.xml

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

Glassfish alternatedocroot glassfish-web.xml

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

. servletcontainer. URL-, , :

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

PrimeFaces StreamedContent API homegrowing .

. :

+13

All Articles