簡體   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