2014-11-25 43 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"/> 
相关问题