I am beginner.
I am doing a project using Primefaces.
I need to include many pages dynamically when triggering the p:menuitem
.
I already tried but the dynamic pages are not included properly when clicked on p:menuitem
and that page only show when refresh of the page(browser).
Sample Code
<p:menu>
<p:menuitem action="..." value="Page1"/>
<p:menuitem action="..." value="Page2"/>
<p:menuitem action="..." value="Page3"/>
</p:menu>
<p:outputPanel>
<ui:include src="#{Pages.dynamicaPagesInclude}"/>
</p:outputPanel>
I do not know where I did mistake.
Any Idea?
Please, try this:
index.xhtml:This file is the "main" page, the page which contains the menu to select the dynamic pages to load. When you press over the menuItem, the
page
attribute is set to the selected page value. Then, an ajax request invokes tochangePage
method which is in charge to set the page to load. We say to menuItem that we need toupdate
the outputPanel which contains the new page load to show it on the browser.page1.xhtml:Dummy page which represents a new page.
page2.xhtml:Dummy page which represents a different page.
Pages.java:This java class is the ManagedBean for controlling the view. It contains a string field called
dynamicaPagesInclude
with the path of the page to load. The methodchangePage
gets the attributepage
which was set by the menuitem. Depending its value, chooses a page or other.Sorry for my English level.