将JSF用于<a href="myPicture.png" ...="">

时间:2016-07-18 19:40:44

标签: jsf primefaces el graphicimage

I have the following code:

 <div id="links" class="links">
     <ui:repeat var="storageAttachment"
        value="#{gallerySlideshowController.selectedStorageAttachmentList}"
        varStatus="status">

                 <a
                    href="https://farm9.static.flickr.com/8839/27742500683_1da5eca775_b.jpg"
                    title="Banana"> <p:graphicImage
                       title="#{storageAttachment.name}" cache="true"
                       value="#{galleryPictureThumbnailRequestController.pictureThumbnail}"
                       rendered="#{galleryPictureThumbnailRequestController.pictureThumbnail != null}">
                       <f:param name="id" value="#{storageAttachment.uniqueId}" />
                    </p:graphicImage>
                 </a>
     </ui:repeat>

How can I replace the link in <a href="https://farm9.static.flickr.com/8839/27742500683_1da5eca775_b.jpg" to my picture path? I have stored the path on my local PC for every storageAttachment item. For example: Object1: storageAttachment.path = C:/mypicture.png

So I need something like: href="#{storageAttachment.path}" -> But this is also not correct because I got http://C:/mypicture.png

我该怎么做? 谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

您的PictureThumnailRequestcontroller.pictureThumbnailStreamedContend,没有href种方法或getHref或类似内容,但您可以通过InpuStream > pictureThumbnail.getStream()。我想你想要实现的是渲染图像但更大?

  1. 所以也许可以尝试一个简单的Servlet到render the image
  2. 使用Omnifaces更轻松地渲染。