2017-02-15 67 views
0

我有以下情況:我想在點擊template_detail.xhtml中的commandbutton時更新「tpNavigationDetail」中的內容。單擊命令按鈕時更新其他文件組件

query_overview.xhtml和query_detail.xhtml具有相同的QueryController。

如何使用JSF管理它?

query_detail.xhtml是裏面的template_detail.xhtml query_overview.xhtml是template_navigation.xhtml

我感謝所有幫助

query_detail.xhtml

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:tp="http://www.tp.de/facelets" xmlns:p="http://primefaces.org/ui" 
    xmlns:pe="http://primefaces.org/ui/extensions"> 

<h:body> 
    <ui:composition template="/prime/template/template_detail.xhtml"> 
     <ui:define name="detailLeft"> 
     ... 
     </ui:define> 

     <ui:define name="detailRight"> 
     ...... 
     </ui:define> 

    </ui:composition> 
</h:body> 
</html> 

template_detail內。 xhtml

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.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:fn="http://java.sun.com/jsp/jstl/functions" 
     xmlns:ui="http://java.sun.com/jsf/facelets" 
     xmlns:p="http://primefaces.org/ui" 
     xmlns:c="http://java.sun.com/jsp/jstl/core" 
     xmlns:tp="http://www.tp.de/facelets" 
     xmlns:pe="http://primefaces.org/ui/extensions"> 

    <h:body> 
     <ui:composition template="/prime/template/template.xhtml"> 
     <ui:param name="renderHeader" value="true"/>      
     <ui:define name="frame"> 
      <h:form id="form" enctype="multipart/form-data"> 
       <p:panel rendered="#{p:ifAnyGranted(renderOnRole) or fn:contains(pageStyle, 'useNoRole')}" style="min-height:150px"> 
         <p:commandButton update="@(*[id*=tpNavigationDetailContent])" 
           action="#{controller.update}" 
           value="#{desk_messages.map['button.save']}" 
           rendered="#{controller.updateMode}" 
           disabled="#{!controller.isEntityEditable}" 
           icon="ui-icon-check" />            
       </p:panel>   
      </h:form> 
     </ui:define> 
     </ui:composition> 
    </h:body> 
</html> 

query_overview.xhtml

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:tp="http://www.tp.de/facelets" xmlns:p="http://primefaces.org/ui" 
    xmlns:pe="http://primefaces.org/ui/extensions" xmlns:tpd="http://www.tp-dialog.de/facelets" 
    xmlns:c="http://java.sun.com/jsp/jstl/core"> 

<h:body> 
    <ui:composition template="/prime/template/template_navigation.xhtml"> 
     <ui:param name="controller"  value="#{queryController}"/> 

     <ui:define name="customDetail"> 
      <f:facet name="header"> 
       <p:spacer width="32" height="32" styleClass="tpTitleIcon tpTitleIconExports" style="margin-right: 10px;" /> 
       <h:outputText value="#{desk_messages.map['title.query']}"/>: <tp:outputText object="#{queryController.entity}"/> 
       <h:outputText value=" (#{myWithFailedStatusI18nCategoryModel.i18nCodeMap[queryController.entity.status]})" 
         rendered="#{queryController.entity.status != 'A'}"/> 
      </f:facet> 
      <ui:include src="/prime/query/query_result.xhtml"/> 
     </ui:define> 


    </ui:composition> 
</h:body>  
</html> 

template_navigation.xhtml

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:tp="http://www.tp.de/facelets" xmlns:p="http://primefaces.org/ui" 
    xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:c="http://java.sun.com/jsp/jstl/core" 
    xmlns:pe="http://primefaces.org/ui/extensions"> 

    <h:body> 
     <ui:composition template="/prime/template/template.xhtml"> 
      <ui:param name="renderHeader" value="true"/> 
      <ui:param name="autosize" value="true"/> 

      <ui:define name="frame"> 

       <pe:layoutPane id="tpNavigationDetail" position="center" render="false"> 
        <ui:insert name="customScript"/> 

        <h:form id="form" enctype="multipart/form-data"> 
         <c:if test="${fn:contains(pageStyle, 'customDetail')}"> 
          <p:panel id="tpNavigationDetailContent" style="min-height:150px"> 
           <ui:insert name="customDetail"/> 
          </p:panel> 
         </c:if> 
        </h:form> 
       </pe:layoutPane> 


       <!-- tp navigation --> 
       <pe:layoutPane id="tpNavigationOverview" position="east" size="#{navigationSize}" minSize="#{navigationMinSize}" maxSize="#{navigationMaxSize}"> 
        <f:facet name="header"> 
         <ui:insert name="tpNavigationOverviewHeader"/> 
        </f:facet> 
        <ui:insert name="navigationOverview"/> 
       </pe:layoutPane> 
      </ui:define> 
     </ui:composition> 
    </h:body> 
</html> 
+1

請創建一個[mcve]。在你的問題的方式很多噪音 – Kukeltje

回答

0

你婉更新 「tpNavigationDetail」 但你這樣寫: - update="@(*[id*=tpNavigationDetailContent])"

變化upda te這樣的屬性

update="@(*[id*=tpNavigationDetail])"