简体   繁体   English

图标未出现在p:GraphicImage中

[英]Icons does not appear in p:GraphicImage

I want to add some icons to menubar. 我想在菜单栏中添加一些图标。 I put them into resources/images folder, but they don't appear. 我将它们放到resources / images文件夹中,但是没有出现。

Example: In submenu I added a icon="fail.ico" , but it doesn't appear. 示例:在子菜单中,我添加了一个icon="fail.ico" ,但未显示。

<p:menubar autoDisplay="true" >
        <p:menuitem >     
            <p:commandLink action="index.jsf?faces-redirect=true" >
                <p:graphicImage height="24" width="24" value="resources/images/home.ico" style="border:none" />                
            </p:commandLink>
        </p:menuitem>

        <p:submenu label="sayfa2" icon="fail.ico" > 
            <p:menuitem value="altMenu2" url="altMenu.jsf"/>              
            <p:menuitem value="altMenu3" url="altMenuu.jsf"/>
        </p:submenu>
</menubar>

try like that, works on my jBoss 这样尝试,可以在我的jBoss上运行

<h:graphicImage value="#{pathManager.path}/resources/images/home.ico" />

and write a class and method that handles paths to your resources or look how your deployment tree looks like and hard-code it. 并编写一个处理资源路径的类和方法,或者查看部署树的外观并对其进行硬编码。

That depends on where is your current page(Folders structure), and how your application handles the path. 这取决于您当前的页面在哪里(文件夹结构),以及您的应用程序如何处理路径。 To solve the issue, click with the right button in your missing image(In your web browser) and watch the URL Address, now get back to the application and fix the value of your graphicImage with the correct path. 要解决此问题,请在丢失的图像中(在Web浏览器中)单击右键,然后观看URL地址,现在返回到应用程序,并使用正确的路径修复graphicImage的值。 You might have to use "../resources/images/home.ico" depending on your folders structure 您可能必须使用“ ../resources/images/home.ico”,具体取决于您的文件夹结构

  • Note: Test your page on Firefox before, It's not a requirement for a web browser to support ico files, especially the IE, you may have to convert it to another type 注意:之前在Firefox上测试您的页面,网络浏览器不需要支持ico文件,尤其是IE,您可能必须将其转换为其他类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM