Niko Niko - 10 months ago 59
Ajax Question

JSF cannot update single form in ui:repeat from outside

I have two problems which are closely related:

  1. I need to update a form inside a tag inside ui:repeat from a dialog at the main page and cannot figure out how (because there are many tags in the ui:repeat and I need to update only one)

  2. naming containers are messed up and lose their "index" when I use id in that form (in case of trying to determine the update path expression...)

reason I need this: updating the 'wholelist' (current situation) breaks all
inside the
somehow (no errors...) (the calendar overlay shows at the first time, but after updating the list it does not appear any more (must reload page again). Also I don't want to update 100 elements each time if only one can be changed


<h:panelGroup id="wholelist">
<ui:repeat var="entry" value="#{bean.foundEntries}" id="repeatId">
<customTag:someTag entry="#{entry}" />
<p:dialog widgetVar="dialog" id="dialog">
<p:calendar value="#{}" ... /> <!-- 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...}"/>


and within the
(which is a tag because of multiple reuses) :

... 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}" />

First Question:

I need to refresh one single form from the dialog (=the dialog which needs to know which form I want to refresh, and I have no idea how to do so...)

And how can I get the update-logic working (pass the component to update to the bean so the dialog knows what to update or equal)?

Second Question:

why does JSF generate in case of not defining a id="..." to a naming container within a ui:repeat something like

  • repeatId:0:j_id_c0_6

  • repeatId:1:j_id_c0_6

  • repeatId:2:j_id_c0_6

and when I define a id to the form (
<h:form id="formname">
) something like

  • repeatId:formname

  • repeatId:formname

  • repeatId:formname

which causes duplicateId (because the lack of the "iterator-number" in the name)?

Does this make sense?

Answer Source

I have solved it; error was elsewhere: I have forgotten in an included tag file which caused the js warning (which broke the calendar).

many thanks