繁体   English   中英

如何在同一页面的支持bean中检索ui:param的值

[英]How to retrieve value of a ui:param in the backing bean of same page

我想在我的后备bean中检索ui:param的值,但不是在同一页面中导航时从同一页面检索
我试过了 :

FaceletContext faceletContext = (FaceletContext) FacesContext.getCurrentInstance().getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
String formId = (String) faceletContext.getAttribute("formId");


它也返回null我也尝试过:

String param = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap().get(name);

也返回null
我试图在preRenderView和postValidate事件中获得这些价,并且以两种方式返回null
别忘了我想获取我所在页面的ui:param的值

我想的问题与我也面临的问题非常相似。 请允许我阐明一下这个问题。

当在“ p:dialog”下包裹两个“ ui:include”时,我会遇到此问题。

<p:dialog header="Customer Selection Criteria" widgetVar="customerSelectionDialog" width="1200" position="center" appendToBody="true">
        <h:form id="customerForm">
            <p:outputPanel id="customerSelection">
                <ui:include src="../INTERNAL/8500.xhtml">
                    <ui:param name="showCidSelect" value="1" /> 
                    <ui:param name="targetObject" value="#{customerDetailsInquiry.cf8444.cg1014.cg1014cidnumb}" />
                </ui:include>
                <p:commandButton rendered="false" value="#{COMMON.COMMON_SELECTBUTTON}" action="#{customerDetailsInquiry.tchelp.handleReturnFromCustomerSelectionCriteria}" oncomplete="customerSelectionDialog.hide();" update=":mainForm:cf8444icg1014c1002" >
                    <f:setPropertyActionListener value="#{customerSearchEngine}" target="#{flash.customerSearchEngine}"/>
                </p:commandButton>
            </p:outputPanel>
        </h:form>
    </p:dialog>
    <p:dialog closeOnEscape="true" modal="true" appendToBody="false" header="Entity Stack" widgetVar="entityStackDialog" width="400" >
        <h:form id="entityForm">
            <ui:include src="../INTERNAL/StackedEntity.xhtml">
                <ui:param name="displayCaption" value="CID Numbers" />

                <ui:param name="department" value="8" /> 
                <ui:param name="stackedObject" value="#{customerDetailsInquiry.cf8444.cg1014.cg1014cidnumb}" />
            </ui:include>

        </h:form>
    </p:dialog>

现在,当我尝试启动8500.xhtml时,我的showCidSelect参数值始终返回“ null”。 如果我按以下方式替换代码,则效果很好

<p:dialog header="Customer Selection Criteria" widgetVar="customerSelectionDialog" width="1200" position="center" appendToBody="true">
        <h:form id="customerForm">
            <p:outputPanel id="customerSelection">
                <ui:include src="../INTERNAL/8500.xhtml">
                    <ui:param name="showCidSelect" value="1" /> 
                    <ui:param name="targetObject" value="#{customerDetailsInquiry.cf8444.cg1014.cg1014cidnumb}" />
                </ui:include>
                <p:commandButton rendered="false" value="#{COMMON.COMMON_SELECTBUTTON}" action="#{customerDetailsInquiry.tchelp.handleReturnFromCustomerSelectionCriteria}" oncomplete="customerSelectionDialog.hide();" update=":mainForm:cf8444icg1014c1002" >
                    <f:setPropertyActionListener value="#{customerSearchEngine}" target="#{flash.customerSearchEngine}"/>
                </p:commandButton>
            </p:outputPanel>
        </h:form>
    </p:dialog>
    <p:dialog closeOnEscape="true" modal="true" appendToBody="false" header="Entity Stack" widgetVar="entityStackDialog" width="400" >
        <h:form id="entityForm">
            <ui:include src="../INTERNAL/StackedEntity.xhtml">
                <ui:param name="displayCaption" value="CID Numbers" />
                <ui:param name="showCidSelect" value="1" />
                <ui:param name="department" value="8" /> 
                <ui:param name="stackedObject" value="#{customerDetailsInquiry.cf8444.cg1014.cg1014cidnumb}" />
            </ui:include>

        </h:form>
    </p:dialog>

我必须为两个“ ui:include”显式传递showCidSelect,以使其正常工作。

可能这是您也面临的相同问题?
发布一些UI示例代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM