Layout p:在模板客户端中使用时未呈现布局组件
我正在使用JSF2.0和PrimeFaces2.2.1。在my template.xhtml中,我有一个Layout p:在模板客户端中使用时未呈现布局组件,layout,jsf-2,primefaces,facelets,Layout,Jsf 2,Primefaces,Facelets,我正在使用JSF2.0和PrimeFaces2.2.1。在my template.xhtml中,我有一个ui:insert组件: <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.prime.com.t
ui:insert
组件:
<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.prime.com.tr/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>A page</title>
</h:head>
<h:body>
<ui:insert name="content"></ui:insert>
</h:body>
</html>
一页
在使用上述模板的myPage.xhtml中,我定义了一个
组件,如下所示:
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
template="./../template/template.xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:f="http://java.sun.com/jsf/core">
<ui:define name="content">
<p:layout>
<p:layoutUnit position="center">
Center unit
</p:layoutUnit>
<p:layoutUnit position="right" collapsible="true">
Right unit
</p:layoutUnit>
</p:layout>
</ui:define>
</ui:composition>
<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.prime.com.tr/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>A page</title>
</h:head>
<h:body>
<p:layout>
<p:layoutUnit position="center">
<ui:insert name="center"></ui:insert>
</p:layoutUnit>
<p:layoutUnit position="right" collapsible="true">
<ui:insert name="right"></ui:insert>
</p:layoutUnit>
</p:layout>
</h:body>
</html>
中心单位
正确的单位
当我打开myPage.xhtml时,我看到了“中心单元”和“右单元”,但没有看到任何呈现的布局
但是,当我尝试将
组件放入模板中时,如下所示:
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
template="./../template/template.xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:f="http://java.sun.com/jsf/core">
<ui:define name="content">
<p:layout>
<p:layoutUnit position="center">
Center unit
</p:layoutUnit>
<p:layoutUnit position="right" collapsible="true">
Right unit
</p:layoutUnit>
</p:layout>
</ui:define>
</ui:composition>
<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.prime.com.tr/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>A page</title>
</h:head>
<h:body>
<p:layout>
<p:layoutUnit position="center">
<ui:insert name="center"></ui:insert>
</p:layoutUnit>
<p:layoutUnit position="right" collapsible="true">
<ui:insert name="right"></ui:insert>
</p:layoutUnit>
</p:layout>
</h:body>
</html>
一页
一切都很完美。使用第二个模板的任何页面都会按预期呈现组件
如果有人能告诉我第一个模板有什么问题,我将不胜感激。我认为在
中使用
是不可能的
您可以在
中使用
,但是:
<p:layout>
<p:layoutUnit position="center">
<ui:insert name="Center unit" />
</p:layoutUnit>
<p:layoutUnit position="right" collapsible="true">
<ui:insert name="Right unit" />
</p:layoutUnit>
</p:layout>