2015-02-09 72 views
3

如何將圖像添加到菜單欄中?如何將圖像添加到primefaces菜單欄?

我不能將h:graphicImage添加到MenuBar(請參閱下面的代碼),並且希望在菜單欄中放置徽標。

enter image description here

當前代碼:圖像來自於頂部

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

回答

6

添加graphicImage的一個菜單項:

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