JSF更新来自不同形式的组件,两者都以prependid false形式

时间:2014-01-29 17:35:49

标签: jsf jsf-2 primefaces

嗨我有这个场景,我有2个表格,每个表格都有preprendId = false,第一个有h:panelGroup,我想从第二个h:form更新。我有的问题 是我不知道我必须放置什么字符串来更新我的panelGroup。我试过这个字符串:

panelGroupComboId和:panelGroupComboId

但我总是得到:无法找到带表达式的组件":panelGroupComboId"引用自......

因为我需要至少以第一种形式(我的panelGroup所在)使用preprendId = false,所以我无法设置preprendIf = true,但如果我这样做,我可以使用以下任何问题更新我的组件::loginFormRegistroId :panelGroupComboId

但请记住我需要使用preprendId = false,当我使用preprendId = false时我可以看到使用 我的h:panelGroup被转换为id为panelGroupComboId的div的firebug,那就是为什么我不知道如何调用它来更新它。

preprendId = true是唯一的方法吗?

FIRST FORM

 <h:form id="loginFormRegistroId" prependId="false">
    <h:panelGroup id="panelGroupComboId" layout="block">
        <select id="comboCarreraId" name="comboCarreraId" class="form-control">
            <ui:repeat value="#{miBean.list}" var="obj">
                <option value="#{obj.id}">#{obj.name}</option>
            </ui:repeat>
        </select>
    </h:panelGroup>
</h:form>

第二种形式

 <h:form prependId="false">
    <p:remoteCommand
        name="cargarCarrerasRemoteCommand"
        process="@this"
        actionListener="#{miBean.myListener}"
        update="panelGroupComboId">
    </p:remoteCommand>
</h:form>

顺便说一下,我不要想要更新整个第一张FORM,只需要我的h:panelGroup

1 个答案:

答案 0 :(得分:1)

从表单中删除prependId。将代码更新为

<h:form>
    <p:remoteCommand
        name="cargarCarrerasRemoteCommand"
        process="@this"
        actionListener="#{miBean.myListener}"
        update=":loginFormRegistroId:panelGroupComboId">
    </p:remoteCommand>
</h:form>