K.Ariche
K.Ariche

Reputation: 1197

PrimeFaces/JSF resources folder not reconized

I'm trying to use an image in my XHTML page

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
 <h:body>

   <h:form>
        <h:graphicImage  library="default" value="img/image.jpg" />
   </h:form>

  </h:body>
</html>

and this is my folder Tree

and the resutl is that the file is not loaded

Upvotes: 0

Views: 738

Answers (1)

user2880020
user2880020

Reputation:

Try this instead, use the name attribute when you use the library attribute, or alternatively put the full path in value attribute.

1.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
 <h:body>
   <h:form>
        <h:graphicImage  library="default" name="img/image.jpg" />
   </h:form>
  </h:body>
</html>

2.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
 <h:body>

   <h:form>
        <h:graphicImage  value="/resources/default/img/image.jpg" />
   </h:form>

  </h:body>
</html>

Upvotes: 1

Related Questions