1

我遇到了使用问题<p:commandLink>,我使用了

<p:commandLink action="#{commonOrgPage.preCreateCommonOrg}" 
               immediate="true" 
               update=":createCommonOrgForm:addCommonOrg" 
               oncomplete="addDlg.show();"> 

要显示一个添加对话框,在它之前,我应该调用操作并更新对话框。但是现在没有调用该操作并显示对话框。

主页.xhtml

    <ui:define name="mainLayoutTitle">Home Page</ui:define>
    <ui:define name="bodyName">
        <ui:decorate template="/pages/commons/layouts/contentLayout.xhtml">
            <ui:define name="leftContentName">
                <ui:include src="/maintainCodeMenu.xhtml"></ui:include>
            </ui:define>
            <ui:define name="rightContentName">
                    <p:outputPanel id="rightContentPanel" >
                        <p:outputPanel rendered="${commonOrgPage.commonOrgTypeName !=null}">
                            <ui:include src="/pages/admin/commonorg/viewCommonOrgList.xhtml"></ui:include>
                        </p:outputPanel>
                    </p:outputPanel>
            </ui:define>
        </ui:decorate>
    </ui:define>    

</ui:composition>

维护代码菜单.xhtml

<h:form id="codeMenu">
<div>Common Organisations</div>
<p:separator />
<div>
    <p:commandLink id="Bank" value="Add Bank" action="#{commonOrgPage.listCommonOrgByCriteria}"
            update=":rightContentPanel" ajax="false">
        <f:param name="commonOrgTypeCode" value="B" />
        <f:param name="commonOrgTypeName" value="Bank"/>        
    </p:commandLink>
</div>  
<div>
    <p:commandLink id="School" value="Add School" action="#{commonOrgPage.listCommonOrgByCriteria}"
            update=":rightContentPanel" >
        <f:param name="commonOrgTypeCode" value="SH" />
        <f:param name="commonOrgTypeName" value="School"/>      
    </p:commandLink>
</div>
</h:form>
</ui:composition>

viewCommonOrgList.xhtml

<h:form id="commonOrgList">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
    <tbody>
        <tr>
            <td class="pgHdr">
                <div style="float: right">
                    <p:commandLink action="#{commonOrgPage.preCreateCommonOrg}" immediate="true" update=":createCommonOrgForm:addCommonOrg" oncomplete="addDlg.show();" styleClass="button">
                        <span>Add</span>
                    </p:commandLink>
</div></td></tr></tbody></table></h:form>
<p:dialog header="Add Common Organisation"  appendToBody="true" draggable="false" widgetVar="addDlg" resizable="false" id="addDialog" showEffect="fade" modal="true" >
    <h:form id="createCommonOrgForm">
    <h:panelGroup id="addCommonOrg">
    <ui:include src="/pages/admin/commonorg/createOrUpdateCommonOrg.xhtml"></ui:include>
    </h:panelGroup>
    </h:form>
</p:dialog>

解决了将 PageBean 范围设置为“会话”的预览问题。但是如果我把<h:outputFormat value="#{commonOrgPage.commonOrgTO.orgEffectiveFrom}"/>而不是

<ui:include src="/pages/admin/commonorg/createOrUpdateCommonOrg.xhtml"></ui:include>

我们可以在调用 #{commonOrgPage.preCreateCommonOrg} 操作后获取新值。但是,当我们使用<ui:include>对话框时无法获得新值。

4

0 回答 0