0

I am new in primefaces while reading books and searching through google, i have learnt a lot. However, i was not able to figure out how to make primefaces menubar present in all pages. Lets say i have menu.xhtml page for menubar.

<h:form>
    <p:menubar>
        <p:menuitem value="Home" outcome="/welcomePrimefaces.xhtml"></p:menuitem>
        <p:menuitem value="Contact Us" outcome="/testal.xhtml"></p:menuitem>
        <p:menuitem value="About US" outcome="/test2.xhtml"></p:menuitem>
    </p:menubar>
    </h:form> 

When i click "Home" it opens home page and disappear the menubar and i have to navigate back to go to other pages.I want menubar appear on every page i created. This is very simple question please don't feel irritated.

joe
  • 15
  • 1
  • 6
  • You need to create template with `ui:insert` and `ui:define` for example and include your `p:menubar` in it. – Geinmachi Feb 02 '16 at 18:21
  • Can you elaborate it little more. – joe Feb 02 '16 at 18:25
  • So i have to include this in every page. '' – joe Feb 02 '16 at 18:28
  • 1
    You can create template with two sections: one static with `p:menubar` and one dynamic with page content. When you create page you use this template and insert only dynamic part (the statis one will be included automatically). Have a look here http://stackoverflow.com/questions/4792862/how-to-include-another-xhtml-in-xhtml-using-jsf-2-0-facelets – Geinmachi Feb 02 '16 at 18:30
  • @Joe: please start by reading some tutorials about jsf. Start simple and then more complex ones. – Kukeltje Feb 02 '16 at 18:41
  • @Geinmachi: thanks a lot.. – joe Feb 02 '16 at 19:18

0 Answers0