Somehow I can't find the answer to my problem...
In my WebApplication, I include content with ui:include. Now my problem is, that all Primefaces components (Buttons, InputText Fields,...) in the included files won't work, although they show in the view.
My layout file:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="130" style="border: none">
<h1 align="center">Adressbuch</h1>
</p:layoutUnit>
<p:layoutUnit position="west" size="270" style="border:none; padding-left: 15px">
<h:form>
<p:menu>
<p:submenu label="Menu">
<p:menuitem value="Home" actionListener="#{navigationBean.setCurrentPage('welcome')}" update=":content"/>
<p:menuitem value="Test" actionListener="#{navigationBean.setCurrentPage('test')}" update=":content"/>
</p:submenu>
</p:menu>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center" style="border: none">
<p:panel id="content" style="border: none">
<ui:include src="#{navigationBean.currentPage}" />
</p:panel>
</p:layoutUnit>
</p:layout>
</h:body>
</html>
My Navigation Bean:
@Named(value = "navigationBean")
@RequestScoped
public class NavigationBean {
private final String PATH = "/WEB-INF/resources/sites/";
private String currentPage;
/**
* Creates a new instance of NavigationBean
*/
public NavigationBean() {
this.currentPage = this.PATH + "welcome.xhtml";
}
public String getCurrentPage() {
return currentPage;
}
public void setCurrentPage(String currentPage) {
this.currentPage = this.PATH + currentPage + ".xhtml";
}
}
Example Content that is loaded in the content section of the layout file:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<p:panelGrid columns="4">
<p:outputLabel for="name" value="Name:" style="font-weight:bold" />
<p:inputText id="name" value="#{basicView.text}" />
<p:commandButton value="Submit" update="display" icon="ui-icon-check" />
<p:outputLabel id="display" value="#{basicView.text}" />
</p:panelGrid>
</h:body>
</html>