简体   繁体   English

如何将图像添加到primefaces菜单栏?

[英]How to add an image to a primefaces menubar?

How can I add an image to a menubar? 如何将图像添加到菜单栏?

I can not add the h:graphicImage to the MenuBar (see code below), and would like to have the logo in the menubar. 我无法将h:graphicImage添加到MenuBar(请参阅下面的代码),并希望在菜单栏中添加徽标。

在此输入图像描述

Current code: The image comes on top 当前代码:图像显示在顶部

<h:form id="navigation">

    <h:link outcome="/index.xhmtl">
        <h:graphicImage url="http://upload.wikimedia.org/wikipedia/commons/8/81/Wikimedia-logo.svg" height="75"/>
    </h:link>

    <p:menubar>
        <p:submenu label="Routine">
            <p:menuitem value="Item 1" outcome="/routine/item1.xhtml"/>
            <p:menuitem value="Item 2" outcome="/routine/item1.xhtml"/>
            <p:menuitem value="Item 3" outcome="/routine/item1.xhtml"/>
        </p:submenu>
        <p:submenu label="Lab">
            <p:menuitem value="Item 1" outcome="/lab/item1.xhtml"/>
            <p:menuitem value="Item 2" outcome="/lab/item2.xhtml"/>
        </p:submenu>
        ...
        <p:menuitem value="Log out" action="#{userBacking.logout()}" />
    </p:menubar>

</h:form>

Add the graphicImage in a menuItem: 在menuItem中添加graphicImage:

<p:menuitem>
    <h:link outcome="/index.xhmtl">
        <h:graphicImage name="/customer/0_0_1/img/logo.png" height="50" />
    </h:link>
</p:menuitem>

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

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