2

I have a problem using ui:repeat nested in each other where I'd like to call a listener. I have also tried c:forEach instead, but got the same problem.

For demonstrating the problem I have simplified the code to the problem. There are two buttons, the first inside the first ui:repeat, calling successful a simple listener. The second button is inside the nested ui:repeat element, should call the same listener as the first button, but the listener is never called.

Can you please tell me whats wrong with this?

<div>
    <ui:repeat var="testList" value="#{testBean.testList}">
        <h:commandButton value="test1">
            // the listener is called if I click this button
            <f:ajax event="click" execute="@this" listener="#{testBean.testListener}" />
        </h:commandButton>
        <ui:repeat var="nestedList" value="#{testList.nestedList}">
            <h:commandButton value="test2">
                // the listener will not be called if I click this button
                <f:ajax event="click" execute="@this" listener="#{testBean.testListener}" />
            </h:commandButton>
        </ui:repeat>
    </ui:repeat>
</div>
user2090297
  • 23
  • 1
  • 3
  • where is your `h:form` ? also remove `event="click" execute="@this"` from buttons – Daniel Feb 20 '13 at 09:01
  • There is a surrounding `h:form`, I have just simplified the code here. I dont' use buttons in the actual code, just to test for myself and for demonstrating here. Even if I remove both attributes the listener is not be called by the second button. – user2090297 Feb 20 '13 at 09:19

1 Answers1

3

This is a known Mojarra issue related to broken state management of <ui:repeat>. Specifically this issue is reported as issue 1817 and fixed since Mojarra 2.1.15.

Upgrade your Mojarra version. It's currently already at 2.1.19.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thank you very much. This solved the problem. But unfortunately I get an NullPointerException after calling the listener in javax.servlet.http.Cookie.setDomain with Mojarra 2.1.17 and 2.1.19. The previous version (2.1.16) works fine! – user2090297 Feb 20 '13 at 14:13
  • 1
    As per your edited comment, ask a new question with the complete stacktrace or report it to Mojarra guys if you're confident that it's a Mojarra bug. – BalusC Feb 20 '13 at 14:18