gpt4 book ai didi

jsf - 如何渲染

conditionally depending on if the resource exists

转载 作者:行者123 更新时间:2023-12-03 17:50:33 26 4
gpt4 key购买 nike

如何渲染 <p:graphicImage>仅当资源 URL 有效时?

<p:graphicImage url="#{resource['images/image.png']}" />

基本上,我只想在 #{resource['images/image.png']} 时呈现我的图形图像实际存在。我怎样才能验证这一点?我试着关注 this JavaScript example ,但我没有成功。

最佳答案

检查是否 ResourceHandler#createResource() 不返回 null .

<p:graphicImage name="images/image.png" rendered="#{not empty facesContext.application.resourceHandler.createResource('images/image.png')}"/>

请注意,我替换了 url="#{resource['resourceName']}"通过更简单的 name="resourceName" .

关于jsf - 如何渲染 <p :graphicImage> conditionally depending on if the resource exists,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25570159/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com