I am new to JSF and PrimeFaces and have a couple of problems developing a full page layout with multiple menus.
ISSUE No. 1
We have a full page layout using PrimeFaces 3.3 with nested layout blocks on the left:
<p:layoutUnit id="west" position="west" header="Services" resizable="true" closable="true" collapsible="true" effect="drop"> <p:layout> <p:layoutUnit id="inner_center" position="center"> <h:form id="formMainMenu"> <ui:include src="#{menuBean.pageToDisplay}.xhtml" /> </h:form> </p:layoutUnit> <p:layoutUnit id="inner_south" size="200" position="south"> <h:form id="formStartMenu"> <p:menu> <p:submenu label="Start Menu"> <p:menuitem value="Start" actionListener="#{#menuBean.setPageToDisplay('template/menu/start')}" update=":inner_center" /> </p:submenu> </p:menu> </h:form> </p:layoutUnit> </p:layout> </p:layoutUnit>
Here is the bean support:
@ManagedBean(name = "menuBean") @SessionScoped public class menuBean implements Serializable { private String pageToDisplay = "template/menu/main"; public String getPageToDisplay() { return this.pageToDisplay; } public void setPageToDisplay(String pageToDisplay) { this.pageToDisplay = pageToDisplay; } }
When I click on a menu item, the whole LayoutUnit (inner_center) disappears. I tried many combinations of Forms and Panel controls with Ajax and could not load the second page and menu. Maybe my approach is wrong due to my limited knowledge in JSF. I hope this is something simple and I will just skip it.
From the menuItem element, I want to load another PrimeFaces bean menu in the internal center layout. Perhaps I do not need to do this and just call up the menu via Ajax?
ISSUE No. 2 With these nested layouts, when the page loads, the parent LayoutUnit "Services" header completely disappears.
<p:layoutUnit id="west" position="west" header="Services" resizable="true" closable="true" collapsible="true" effect="drop">
Any help or advice on a general approach is greatly appreciated!
Thanks!
jsf jsf-2 primefaces menuitem
Ryan M.
source share