【问题标题】:Cannot find component with identifier in view在视图中找不到带有标识符的组件
【发布时间】:2012-05-30 09:22:27
【问题描述】:

我有一个问题是,当我尝试更新不在同一个 xhtml 中的组件时。

有人知道怎么做吗?

谢谢 PD:我使用的是 primefaces 3.2

对不起我的英语

我觉得我解释的不是很好。

我有一个带有tis结构的xhtml父亲:

<h:panelGrid id="tabla">

    <h:form id="formTripu" prependId="false">
        <h:panelGrid id="fichaTripulante">
            <ui:include src="path1" />
            <p:spacer height="5px" />
            <p:tabView dynamic="false" cache="true">
                <p:tab title="#{bundleTrip.datosAdministrativos}">
                    <ui:include
                        src="path2" />
                </p:tab>
                <p:tab title="Datos Operativos ">
                    <ui:include
                        src="path3" />
                </p:tab>

我希望做的是,例如在 path1 中我使用 h:selectBooleanCheckbox 之类的:

                    <h:selectBooleanCheckbox inmediate="true" id="checkExt"
                        value="#{bean.Obj.field}">
                        <f:ajax render="estadoTripu"
                            actionListener="#{bean.method}" />
                    </h:selectBooleanCheckbox>

estadoTripu 在 path2 中(otherxthml 但格式相同)。

<p:panel>
    <h:panelGrid id="datos" columns="5">
        <p:column>

                <h:selectOneMenu id="estadoTripu" 
                    value="#{bean.Obj.Field2}">
                    <f:selectItems
                        value="#{bean.list}" var="item"
                        itemValue="#{item.id}" immediate="true"
                        itemLabel="#{item.desc}">
                    </f:selectItems>
                </h:selectOneMenu>
            </h:panelGrid>
        </p:column>
    </h:panelGrid>
</p:panel>  

Witch 正在渲染 f:ajax????

谢谢大家

【问题讨论】:

    标签: jsf primefaces


    【解决方案1】:

    试试这个:(这是我从 BalusC 学到的一个技巧 :))

    binding="#{components.mySelecOneMenu}" 添加到您的h:selectOneMenu

    <h:selectOneMenu binding="#{components.mySelecOneMenu}" .....
    

    你的按钮应该是什么样子(或多或少)

    <h:commandButton value="doSomeThing">
        <f:ajax render="#{components.mySelecOneMenu.clientId}"/>
    </<h:commandButton>
    

    将此添加到您的faces-config.xml

    <managed-bean>
        <description>Holder of all component bindings.</description>
        <managed-bean-name>components</managed-bean-name>
        <managed-bean-class>java.util.HashMap</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    

    这里有一些我只是建议你做的详细解释

    How do I break the tyranny of the clientID?

    JSF component binding without bean property

    【讨论】:

      【解决方案2】:

      如果它们不在同一个 xhtml 中,你会在另一个中包含一个吗?如果没有,只需更改页面,它将显示正确的页面。

      但我认为我没有正确理解您的问题。

      请添加一些代码

      【讨论】:

        【解决方案3】:

        我发现组件应该采用相同的形式,调用 id 以形式开始到组件,它首选将 id 放置在每个面板网格、面板等,因为您必须调用要渲染的每个组件 englobe 组件。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-10-01
          • 2013-07-02
          • 1970-01-01
          • 2012-05-19
          • 1970-01-01
          • 2012-11-10
          • 1970-01-01
          • 2021-01-29
          相关资源
          最近更新 更多