0


我想在我的支持 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 的值

4

1 回答 1

-1

我想这个问题与我也面临的问题非常相似。请允许我对这个问题进行一些说明。

当“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 示例代码。

于 2013-10-22T10:03:58.057 回答