2014-11-25 46 views
0

我有一個layoutUnit west和layoutUnit中心的佈局,西面有一個調用另一個頁面的菜單,這個頁面在中心渲染,問題是當另一個頁面在中心渲染時,所有的佈局刷新(西面和中心面)。我有如下代碼:JSF-PrimeFaces,如何只刷新<p:layoutUnit position =「center」>而不是全部<p:layout>?

<p:layout style="width: 100%; height: 450px" > 
       <p:layoutUnit position="west" size="230" collapsible="false" > 
        <h:form>       

         <p:menu style="font-size: 14px; width: 95%;height: 420px " > 
          <p:submenu label="MENU"> 

           <p:menuitem value="Students" icon="ui-icon-arrowthick-1-n" url="pantallas/students.xhtml" />  
           <p:menuitem value="Teachers" icon="ui-icon-refresh" url="pantallas/teacher.xhtml" /> 


          </p:submenu> 


         </p:menu> 
        </h:form> 

       </p:layoutUnit> 

       <p:layoutUnit id="layout1" position="center" > 
        <h:form> 
         <ui:insert name="content" ></ui:insert> 
        </h:form> 


       </p:layoutUnit> 

      </p:layout> 

而且student.xhtml喜歡:

<ui:composition template="../administracion.xhtml" 
      xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://xmlns.jcp.org/jsf/html" 
      xmlns:p="http://primefaces.org/ui" 
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets" 
      xmlns:f="http://xmlns.jcp.org/jsf/core"> 
<ui:define name="content"> 
    <h:head> 
     <h:outputStylesheet library="css" name="styles2.css"/> 
     <title>Facelet Title</title> 
    </h:head> 

    <h:body> 
     <p:panel header="Student" style="width: 90%; margin: auto auto"> 
      <h:form id="forma1"> 
       <p:panel style="text-align: center"> 
        <p:inputText placeholder="Students" value="#{datosCT.cct}"/> 
        <p:commandButton value="buscar" actionListener="#{controlCTAlumnos.traeInfo()}" update="panel1"> 
         <f:ajax listener="#{controlCTAlumnos.mostrarPanel(e)}" render="panel1" /> 
        </p:commandButton> 

       </p:panel> 

      </h:form> 
     </p:panel> 

    </h:body> 
</ui:define> 

我看到和嘗試了一些方法很多隻刷新layoutUnit中心,但在這種情況下doesn't工作。

有人可以幫助我嗎?

在此先感謝。

+0

你不應該直接把''裏面''。將它們全部分開,將每個單元的內容放置在各自的XHTML文件中(通常位於WEB-INF文件夾下),並使用將它們包含在主頁面模板中。 ''標籤內''p:layoutUnit id =「layout1」position =「center」>'是多餘的,不再需要)。您始終可以使用像<'這樣的容器組件來封裝您想要更新/呈現的感興趣組件。 – Tiny 2014-11-25 06:35:25

回答

0

您可以從內容頁面對佈局單元中的表單組件進行部分更新。

<p:layoutUnit id="layout1" position="center" > 
    <h:form id="form> 
     <ui:insert name="content" ></ui:insert> 
    </h:form> 
</p:layoutUnit> 

student.xhtml

<p:commandButton value="buscar" update=":form"/> 
相關問題