单击commandButton时更新其他文件组件

时间:2017-02-15 16:13:59

标签: jsf primefaces

我有以下情况:我想更新" tpNavigationDetail"单击template_detail.xhtml中的命令按钮时。

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 个答案:

答案 0 :(得分:0)

你要更新“tpNavigationDetail”,但你写的是: - update="@(*[id*=tpNavigationDetailContent])"

像这样更改更新属性

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

相关问题