【发布时间】:2015-05-28 18:35:18
【问题描述】:
我是 stackoverflow 的新手,这也是我对这个论坛的第一个问题,所以如果我在这里发帖时做错了什么,请告诉我。
我的问题与 primefaces 相关,我尝试了很多解决方案,但对我没有任何作用。
我正在使用...
- jsf 2.2.4
- primefaces 5.2
- tomcat 8
下面的代码是我的 template.xhtml 它位于 /templates/template.xhtml
<!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://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<f:view contentType="text/html" id="fview">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Page template with PrimeFaces</title>
<ui:debug />
<f:metadata>
<ui:insert name="metadata" />
</f:metadata>
<h:head>
<p:layout fullPage="true" resizeTitle="resize"
style="background-color:#FFFFFF;">
<p:layoutUnit position="north" size="68" id="north">
<ui:include src="header.xhtml" />
</p:layoutUnit>
<p:layoutUnit position="west" id="west" resizable="false" size="225">
<ui:include src="menu.xhtml" />
</p:layoutUnit>
<p:layoutUnit position="center" id="centerLayout">
<h:form id="mainForm">
<p:messages autoUpdate="true" id="msgs" showDetail="true"
showSummary="true" />
<ui:insert name="content" />
</h:form>
</p:layoutUnit>
<p:layoutUnit position="east" size="0"
style="width:0px; display:none;" id="east">
</p:layoutUnit>
<p:layoutUnit position="south" resizable="true" id="south">
<ui:include src="footer.xhtml" />
</p:layoutUnit>
</p:layout>
</h:head>
下面的代码是我的 home.xhtml 它位于 pages/home.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
template="../templates/template.xhtml">
<ui:define name="metadata">
</ui:define>
<ui:define name="content">
Hello world! Welcome to a page derived from a template
</ui:define>
当我成功运行我的应用程序请求时,转到控制器并返回。但是浏览器会发出警报
> / UI 布局初始化错误 中心窗格元素不存在。 中心窗格是必需元素。
如果有人知道我的问题的正确答案,请帮助我。
提前致谢。
【问题讨论】:
-
无意冒犯,但我会先搜索 SO 或 google,但有此例外。
-
没有朋友..我已经尝试过,但这对我不起作用。我已经将该部分添加到 web.xml 中,但这对我不起作用
标签: jsf-2 primefaces