PrimeFaces / JSF资源文件夹无法识别

时间:2014-11-26 23:06:06

标签: image jsf primefaces

我正在尝试在我的XHTML页面中使用图像

<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

并且resutl是文件未加载

1 个答案:

答案 0 :(得分:1)

请尝试使用name属性时使用library属性,或者将完整路径放在value属性中。

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>
相关问题