JSF无法在ui中更新单个表单:从外部重复

时间:2016-11-21 21:46:50

标签: ajax jsf primefaces naming-containers

我有两个密切相关的问题:

  1. 我需要更新ui内部标签内的表单:从主页面的对话框中重复,并且无法弄清楚如何(因为ui中有很多标签:重复,我只需要更新一个)
  2. 当我在该表单中使用id时(如果尝试确定更新路径表达式...),命名容器会搞砸并丢失其“索引”。
  3. 我需要这个原因:更新'整个列表'(当前情况)会以某种方式打破<p:calendar>内的所有<p:dialog>(没有错误......)(日历叠加层第一次显示,但是更新列表后,它不再出现(必须再次重新加载页面)。另外,如果只有一个元素可以更改,我不想每次更新100个元素

    page.xhtml

    <h:panelGroup id="wholelist">
        <ui:repeat var="entry" value="#{bean.foundEntries}" id="repeatId">
            <customTag:someTag entry="#{entry}" />
        </ui:repeat>
    </h:panelGroup>
    ... 
    <p:dialog widgetVar="dialog" id="dialog">
        <p:calendar value="#{bean.date}" ... /> <!-- overlay pops up on select until the whole list is refreshed. after that it does not appear until page reload -->
        <p:commandButton actionlistener="#{bean.saveSomething()}" update="#{bean.componentToUpdate WHICH DOES NOT WORK...}"/>
    </p:dialog>
    

    someTag.xhtml

    并在 <customTag:someTag> 内(由于多次重复使用,这是一个标记):

     ...
        <h:form>
            ... display a lot of data which can be changed by the dialog...
            <p:commandButton value="show edit dialog" onComplete="PF('dialog').show()" update=":dialog">
               <f:setPropertyActionListener value="??? (@form does not work)" target="#{bean.componentToUpdate}" />
            </p:commandButton>
        </h:form>
    

    第一个问题:

    我需要从对话框中刷新一个单独的表单(=需要知道我要刷新哪个表单的对话框,我不知道怎么做...)

    如何让更新逻辑正常工作(将组件传递给bean更新,以便对话框知道要更新的内容或相同内容)?

    第二个问题:

    为什么JSF会在没有为ui中的命名容器定义id =“...”的情况下生成:重复类似

    的内容
    • repeatId:0:j_id_c0_6
    • repeatId:1:j_id_c0_6
    • repeatId:2:j_id_c0_6

    当我为表单(<h:form id="formname">)定义一个类似

    的内容时
    • repeatId:表格名称
    • repeatId:表格名称
    • repeatId:表格名称

    导致duplicateId(因为名称中缺少“iterator-number”)?

    这有意义吗?

1 个答案:

答案 0 :(得分:0)

我已经解决了;错误在别处:我忘记了一个包含的标签文件,它导致了js警告(打破了日历)。

非常感谢