Search code examples
jsfprimefacesiconsgraphicimage

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.

Example: In submenu I added a icon="fail.ico", but it doesn't appear.

<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>

Solution

  • 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. You might have to use "../resources/images/home.ico" depending on your folders structure

    • 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