primefaces menubar logout right side

13,516

Solution 1

You should use a style="float: right;" inside the button or include the property into your css stylesheet.

Solution 2

I am able to get the logout to the right by using the below code

<f:facet name="options">
   <p:commandButton type="button" value="Logout" />
</f:facet>
Share:
13,516

Related videos on Youtube

borj
Author by

borj

Updated on August 30, 2022

Comments

  • borj
    borj over 1 year

    Hi I followed this code but my logout button is not at the right side of menubar.

    sample from PF

    here is my xhtml page

    <h:body>
        <p:menubar autoDisplay="false">
            <p:menuitem value="Home" url="/index.jsf" />
    
            <p:submenu label="Maintenance" >
                <p:menuitem value="Course" url="/views/course/list.jsf" />
                <p:menuitem value="Student" url="/index.jsf" />
            </p:submenu>
    
            <f:facet name="options">
                <p:commandButton type="button" value="Logout" icon="ui-icon-extlink" />
            </f:facet>
        </p:menubar>
    </h:body>
    
  • borj
    borj over 11 years
    It only works when I remove it from menubar, it kills the purpose of menubar.
  • AgostinoX
    AgostinoX about 11 years
    It works for me. I'm wondering how much tricky is this solution, that is if it is guaranteed to work in different contions and browsers. btw, i'm using pf 3.2
  • AgostinoX
    AgostinoX about 11 years
    Then the menù itself goes beyond the edge of the browser window because it is alligned with the starting of the item in the menù bar. I've adjusted this in a rather tricky way this way: style="float:right;margin-right: 30px;"
  • kleopatra
    kleopatra over 10 years
    Note that link-only answers are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference.