Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 843
BirdOfPrey Avatar asked Oct 08 '22 08:10

BirdOfPrey


1 Answers

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:

  • What is the JSF resource library for and how should it be used?
like image 74
BalusC Avatar answered Oct 13 '22 12:10

BalusC