Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
903 views
in Technique[技术] by (71.8m points)

ajax - jsf listener not called inside nested ui:repeat

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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...