我在这里看到了许多帖子,但没有一个人无法帮助。
这是我的index.xhtml
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
template="templates/template.xhtml">
</ui:composition>
这是我的template.xhml
<?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:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<f:view contentType="text/html" locale="en">
<h:head>
<title><ui:insert name="title">Master Data</ui:insert></title>
<h:outputStylesheet library="css" name="layout.css"/>
<h:outputStylesheet library="css" name="jsfcrud.css"/>
<h:outputScript library="js" name="jsfcrud.js"/>
</h:head>
<h:body>
<h:panelGrid columns="2" columnClasses="chaptersMenuColumn,chaptersContentColumn">
<h:form id="form1">
<p:growl id="messages" autoUpdate="true" />
<p:menu>
<p:submenu label="Master Data Sections">
<p:menuitem value="KPI" actionListener="#{kpiBean.setPage('create')}" update=":form2:secondPart"/>
<p:menuitem value="Queues" actionListener="#{kpiBean.setPage('view')}" update=":form2:secondPart"/>
<p:menuitem value="States"/>
<p:menuitem value="Causes"/>
<p:menuitem value="SubCauses"/>
</p:submenu>
</p:menu>
</h:form>
<h:form id="form2">
<h:panelGroup id="secondPart" layout="block">
<h2>Hi</h2>
<!-- <ui:include src = "/views/#{kpiBean.page}.xhtml"/> -->
<ui:insert name="emptyPage"/>
</h:panelGroup>
</h:form>
</h:panelGrid>
</h:body>
</f:view>
</html>
这是我的empty.xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<ui:define name="emptyPage">
<h3>This is an empty page</h3>
</ui:define>
</ui:composition>
我不明白为什么我不能在索引页面中看到empty.xhtml的内容?