I am using templates, which in my main template I have a
<ui:include src="#{navBean.content}.xhtml">
My problem is that the action method of any bean, is not called having been run on the previous page . Here is an example where when you click the menu on the first page, an ajax call is made, the action method is executed and the page content loaded. By clicking the link on the loaded page(page1) the action method is not executed.
Config: jsf 2.2.9 | primefaces 5.1 | tomcat 8.0.3
template.xhtml
<div>
<div>
<h:form>
<p:slideMenu>
<p:submenu label="Cat 1">
<p:menuitem value="page1" action="#{navBean.changeMenuContent('page1')}" update=":change"/>
<p:menuitem value="bla"/>
</p:submenu>
</p:slideMenu>
</h:form>
</div>
<div>
<h:form id="change">
<ui:include src="/#{navBean.content}.xhtml"/>
</h:form>
</div>
</div>
navBean:
@ManagedBean(name = "navBean")
@RequestScoped
public class NavigationBean
{
private String content = "index";
public void changeMenuContent(String content)
{
setContent(content);
}
//get set...
}
page1.xhtml
<p:commandLink value="teste" action="#{navBean.changeMenuContent('page2')}" ajax="false"/>
The page2 has only one <p: outputLabel />
, for test.
I've tried with p:commandLink
and h:commandLink
Thanks!