PrimeFaces Extensions布局错误 - / UI布局初始化错误:cepter窗格不存在。中心窗格是必需元素

时间:2015-06-16 15:23:30

标签: jsf jsf-2 primefaces primefaces-extensions

我试图使用PrimeFaces扩展程序' (3.2)布局。 但它给我发了following错误: enter image description here

我的代码如下所示:

<ui:composition xmlns:pe="http://primefaces.org/ui/extensions">

<h:form>  
    <pe:layout resizerTip="Resize Me" togglerTipClosed="Open Me" togglerTipOpen="Close Me">  
        <pe:layoutPane position="north" size="80" closable="false">  
            North  
        </pe:layoutPane>  
        <pe:layoutPane position="center">  
            <pe:layoutPane position="north" size="50%">  
                <f:facet name="header">  
                    <h:outputText value="Center-North"/>  
                </f:facet>  
            </pe:layoutPane>  
            <pe:layoutPane position="center" minHeight="60">  
                <f:facet name="header">  
                    <h:outputText value="Center-Center"/>  
                </f:facet>  
            </pe:layoutPane>  
        </pe:layoutPane>  
        <pe:layoutPane position="west" size="200">  
            <pe:layoutPane position="north" size="33%">  
                West-North  
            </pe:layoutPane>  
            <pe:layoutPane position="center" minHeight="60">  
                West-Center  
            </pe:layoutPane>  
            <pe:layoutPane position="south" size="33%" initClosed="true">  
                West-South  
            </pe:layoutPane>  
        </pe:layoutPane>  
        <pe:layoutPane position="east" size="200" resizeWhileDragging="true">  
            East  
        </pe:layoutPane>  
        <pe:layoutPane position="south" size="80">  
            South  
        </pe:layoutPane>  
    </pe:layout>  
</h:form>  

在代码中,我说明了一个带有中心位置的layoutPane,但它却给我一个错误。

其他信息:我正在使用

  • PrimeFaces 4.0
  • PrimeFaces Extensions 3.2.0
  • Mojarra 2.2.7
  • JDK 7

编辑:我发现问题是因为它是从模板页面通过<ui:insert>插入的。该模板页面由<table>构建,并删除<table>它的工作原理,但我确实需要这些表,因为这是我主模板中的表格。有没有办法解决这个问题,或者为兼容组件更新表?

1 个答案:

答案 0 :(得分:2)

问题是布局试图使用整个页面作为父元素的body标签,因为还有其他html,它无法找到中心面板。如果您将fullpage="false添加到布局代码中,那么它将如下所示。生成的布局将在表中创建一个div,用作外部布局容器而不是body标签。

<pe:layout resizerTip="Resize Me" togglerTipClosed="Open Me" togglerTipOpen="Close Me" fullpage="false" style="100%;">

请注意。您可能还需要另外添加style="100%",因为当使用以下代码执行包含并添加fullpage =&#34; false&#34;布局窗格有一个额外的初始化错误,没有高度......因此是不可见的。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html style="height:100%;" xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"  xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
<f:view locale="en">
<h:head>
    <h:outputScript library="javax.faces" name="jsf.js" />
</h:head>
<h:body style="height:100%;">
    <table style="height:100%; width:100%;">
        <tr>
            <th>Layout</th>
        </tr>
        <tr>
            <td style="height:100%;"><ui:include src="PELayoutInclude.xhtml" /></td>
        </tr>
    </table>
</h:body>
</f:view>
</html>