2013-01-24 88 views
1

我正在使用primefaces和Google應用引擎。我張貼此代碼,因爲佈局不起作用。 最初我嘗試使用模板facelets(組合,包括,插入,設置),都沒有工作。我熟悉facelets和jsf在另一個環境中與他們一起工作。 所以我決定嘗試佈局和layouunit,但沒有。Google應用引擎和primefaces佈局/ layoutunit不起作用

謝謝。

<!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:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:p="http://primefaces.org/ui"> 

<f:view contentType="text/html"> 

<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <title>Inicio</title> 
</head> 
    <h:body> 
     <p:layout fullPage="true"> 
     <p:layoutUnit position="top" height="75" header="Top"> 
      <h:outputText value="North unit content1aaaa." /> 
     </p:layoutUnit> 

     <p:layoutUnit position="center"> 
      <h:form> 
       This fullPage layout consists of five different layoutUnits which are     
       resizable and closable by default. 
       </h:form> 
     </p:layoutUnit> 

     <p:layoutUnit position="bottom" height="75" header="Bottom"> 
      <h:outputText value="South unit content." /> 
     </p:layoutUnit> 
     </p:layout> 
    </h:body> 
</f:view> 
</html> 

回答

1

你的代碼中有一些錯誤。

LayoutUnits的值不能是頂部或底部。允許的值是:

<p:layoutUnit position="north"/> 
<p:layoutUnit position="west"/> 
<p:layoutUnit position="east"/> 
<p:layoutUnit position="south"/> 

第二件事是關於

<f:view contentType="text/html"> 

不包括此標籤下的所有內容。只需直接關閉它(如果它真的需要)

<f:view contentType="text/html"/> 

然後你必須編輯你的頭標籤,以

<h:head>...</h:head> 

只是指Primefaces例:http://www.primefaces.org/showcase/ui/layoutFull.jsf

這是你的工作守則:

<!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:h="http://java.sun.com/jsf/html" 
xmlns:f="http://java.sun.com/jsf/core" 
xmlns:ui="http://java.sun.com/jsf/facelets" 
xmlns:p="http://primefaces.org/ui"> 


<h:head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <title>Inicio</title> 
</h:head> 

<h:body> 
    <p:layout fullPage="true"> 
    <p:layoutUnit position="north" height="75" header="Top"> 
     <h:outputText value="North unit content1aaaa." /> 
    </p:layoutUnit> 

    <p:layoutUnit position="center"> 
     <h:form> 
      This fullPage layout consists of five different layoutUnits which are     
      resizable and closable by default. 
      </h:form> 
    </p:layoutUnit> 

    <p:layoutUnit position="south" height="75" header="Bottom"> 
     <h:outputText value="South unit content." /> 
    </p:layoutUnit> 
    </p:layout> 
</h:body> 

</html> 
+0

非常感謝。它工作完美。但是我的代碼是基於GAE primeface用例的例子[link](http://primefaces-rocks.appspot.com/ui/layoutFull.jsf)。 – vcvmartins