Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jsf graphicimage标记不工作_Jsf_Jsf 2_Primefaces - Fatal编程技术网

jsf graphicimage标记不工作

jsf graphicimage标记不工作,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,我正在使用Primefaces 5.2,我需要在我的网页上显示一些图像。 我使用primefaces的GraphicImage标记,在name属性中我传递图像的完整路径,但网页上没有显示任何内容,当我检查生成的html页面的源代码时,img标记的source属性上没有RES NOT FOUND值 这是我的密码 <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML

我正在使用Primefaces 5.2,我需要在我的网页上显示一些图像。 我使用primefaces的GraphicImage标记,在name属性中我传递图像的完整路径,但网页上没有显示任何内容,当我检查生成的html页面的源代码时,img标记的source属性上没有RES NOT FOUND值

这是我的密码

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Add your Experience</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</h:head>
<body>
<div class="container">
        <p:contentFlow value="#{testBean.images}" var="image">
            <p:graphicImage name="C:/Users/Singh/Desktop/Photos/#{image}"
                styleClass="content" />
            <div class="caption">#{image}</div>
        </p:contentFlow>
        <p:graphicImage name="image/bg.jpg" />
        <h:graphicImage name="C:/Users/Singh/Desktop/Photos/abh.jpg"></h:graphicImage>
    </h:form>
</div>
</body>
</html>

您选择了错误的属性,要指定链接,必须选择url属性

<p:graphicImage url="image/bg.jpg" />
<h:graphicImage url="C:/Users/Singh/Desktop/Photos/abh.jpg"></h:graphicImage>

它适用于项目中的图像,但不适用于项目目录之外的图像。我想我需要写一个Servlet哪个是你的服务器?
<h:graphicImage library="images" name="bg.jpg" />