我使用h:graphicImage来使用name属性显示图像。现在,为了成功地实现PrettyPhoto (JQuery实现),我需要结果路径(/javax.faces.resource/pictures/file.png.xhtml)作为我的<a href />的结果。
正如您可以从PrettyPhoto文档片段中看到的那样,我需要将图像路径作为我的<a href />的路径(实际上,由于使用缩略图的事实,这里有一个不同之处):
<a href="images/fullscreen/2.jpg" rel="prettyPhoto" title="This is the description">
<img src="images/thumbnails/t_2.jpg" width="60" height="60" alt="This is the title" />
</a>有任何方法来提取h:graphicImage**) (因为它是以h:outputLink**?** h:outputLink**?**的命名的)
发布于 2012-11-07 22:12:01
您可以使用隐含的EL变量映射器#{resource}将/name转换为完整的URL。
所以,在你的特殊情况下,
<h:outputLink value="#{resource['images/fullscreen/2.jpg']}">
<h:graphicImage name="images/thumbnails/t_2.jpg" />
</h:outputLink>如果您也在使用资源库,那么语法应该如下所示:
<h:outputLink value="#{resource['default:images/fullscreen/2.jpg']}">
<h:graphicImage library="default" name="images/thumbnails/t_2.jpg" />
</h:outputLink>(请注意,您甚至可以使用<a href>而不是<h:outputLink value>__)
https://stackoverflow.com/questions/13279115
复制相似问题