问题
Using ui:repeat
for simple listing of elements produces very strange results - when you add an element, the first element is always replaced with the values from the last element before the submit. Same occurs when removing the elements - the first element shows actually the just removed element.
With h:dataTable
the same works perfectly.
Running Mojarra 2.0.2.
回答1:
This is probably because bug in Mojarra 2.0.2. At least in this case, updating to Mojarra 2.0.3 resolves the issue. However, the bug refers to cases that won't work with even 2.0.3.
Just wanted to write this up into a separate question as I've been having all sorts of problems (and asking all sort of questions) relating to ui:repeat
and this is a specific case again.
Other failings with ui:repeat
:
- Why doesn't h:dataTable inside ui:repeat get correct ID?
- How to refer to dataTable parent within the dataTable?
My conclusion: the whole ui:repeat
tag is totally broken at least in Mojarra 2.0.2. Updating to Mojarra 2.0.3 fixes some of the issues.
来源:https://stackoverflow.com/questions/3890862/jsf-mojarra-2-0-2-uirepeat-is-totally-broken-when-updating-via-ajax