繁体   English   中英

布局PrimeFaces

[英]Layout PrimeFaces

我有一个布局文件如下

<p:layout fullPage="true">
    <p:layoutUnit position="center">
        <p:layoutUnit position="north">
            <ui:insert name="Middle top">
                <h3>This is a Center</h3>
            </ui:insert>
        </p:layoutUnit>

        <p:layoutUnit position="center">
            <ui:insert name="Middle center">
                <h3>This is a Center</h3>
            </ui:insert>
        </p:layoutUnit>
    </p:layoutUnit>
</p:layout>

但是,当我运行布局文件时,什么也没有显示!

我使用的是primefaces 3.5,jsf 2.1。

除中心layoutUnit外,其他布局单位必须具有通过size选项定义的尺寸。

像这样:

<p:layout fullPage="true">
    <p:layoutUnit position="north" size="50">
        <h:outputText value="Top content." />
    </p:layoutUnit>
    <p:layoutUnit position="south" size="100">
        <h:outputText value="Bottom content." />
    </p:layoutUnit>
    <p:layoutUnit position="west" size="300">
        <h:outputText value="Left content" />
    </p:layoutUnit>
    <p:layoutUnit position="east" size="200">
        <h:outputText value="Right Content" />
    </p:layoutUnit>
    <p:layoutUnit position="center">
        <h:outputText value="Center Content" />
    </p:layoutUnit>
</p:layout>

如果您要在项目中使用布局概念,则它应该像这样处理。

 <!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" />       

        <f:metadata>
            <ui:insert name="metadata" />
        </f:metadata>
        <meta  name="selectedLanguage" content="Lang" lang="#{menuBean.selectedLanguage}"/>
        <h:head>
        </head>
        <h:body behavior: url(PIE/PIE.htc);">
             <p:layout fullPage="true" widgetVar="layoutWdgtMain">

                 <p:layoutUnit id="north" position="north" cellpadding="0" cellspacing="0">
                       //enter your code
                 </p:layoutUnit>            
                 <p:layoutUnit id="east" position="east" cellpadding="0" cellspacing="0">
                      //enter your code
                 </p:layoutUnit>    
                 <p:layoutUnit id="west" position="west" cellpadding="0" cellspacing="0">
                      //enter your code
                 </p:layoutUnit>            
                <p:layoutUnit id="south" position="south" cellpadding="0" cellspacing="0">
                     //enter your code
                </p:layoutUnit> 
            </p:layout>
       </h:body>
   </f:view>
</html>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM