Question

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>
Was it helpful?

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

OTHER TIPS

try like that, works on my 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top