2013-06-05 20 views
0

我正在使用PrimeFaces,並且我想知道它可以在同一頁面內多次渲染面板。例如,我有一個面板,如下所示:在多個場合呈現相同的面板

<p:panel id="studentInfo"> 
    <p:commandButton id="viewFullProfile" .... 
    <h:outputText value="Search" /> 
    <p:inputText id="search" .... 
</p:panel> 

我希望此面板在p:tabView控件的每個選項卡中。

<p:tabView id="studentProfile"> 
    <p:tab id="tabA"> 
    ..render "studentInfo" here... 
    </p:tab> 

    <p:tab id="tabB"> 
    ..render "studentInfo" here... 
    </p:tab> 

    <p:tab id="tabC"> 
    ..render "studentInfo" here... 
    </p:tab> 
</p:tabView> 
+0

其實要在所有選項卡中的相同信息或所有選項卡刷新'studentInfo'? –

+0

相同的內容,它像一個標題顯示基本信息將保持不變 –

回答

0

你需要這樣一個簡單的觀點:

studentInfo.xhtml

<ui:composition> 
    <p:panel> 
     #{item} 
    </p:panel> 
</ui:composition> 

注:我目前通過#{item}作爲參數可能是學生實體例如。

您的看法:

<p:tabView id="studentProfile"> 
    <p:tab id="tabA"> 
     <ui:composition template="studentInfo.xhtml"> 
      <ui:param name="item" value="Student A" /> 
     </ui:composition> 
    </p:tab> 

    <p:tab id="tabB"> 
     <ui:composition template="studentInfo.xhtml"> 
      <ui:param name="item" value="Student A" /> 
     </ui:composition> 
    </p:tab> 

    <p:tab id="tabC"> 
     <ui:composition template="studentInfo.xhtml"> 
      <ui:param name="item" value="Student A" /> 
     </ui:composition> 
    </p:tab> 
</p:tabView> 
+1

我認爲他需要'

+0

@RongNK他的問題可以用兩種方式解釋......很快就會知道哪一個是一個! –

+0

我嘗試過使用