Search code examples
jsf-2glassfish-3

JSF2.0 Resource library subfolder file retrieval


How do I reference a file inside the subfolder of the image library with JSF2.0?

JSF2.0 Image subfolder

I have tried many ways using the library and name tag but the most logical seems to be the one below, but it doesn't work!

<h:graphicImage library="images" name="Mecearia\4382982_med.jpg"/>

The server always returns

WARNING: JSF1064: Unable to find or serve resource, Mecearia\4382982_med.jpg, from library, images.

How can I solve this?


Solution

  • The URL path separator is /, not \.

    <h:graphicImage library="images" name="Mecearia/4382982_med.jpg"/>
    

    By the way, you're not using library the right way. It should represent a "theme", not a duplication of whatever the <h:graphicImage> (and <h:outputScript> and <h:outputStylesheet>) tag by itself already tells. If you don't have any (thus just the "default" theme), remove it and use

    <h:graphicImage name="images/Mecearia/4382982_med.jpg"/>
    

    See also: