JSF监听器不叫嵌套的UI里面:重复 [英] jsf listener not called inside nested ui:repeat

查看:204
本文介绍了JSF监听器不叫嵌套的UI里面:重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用问题 UI:重复互相嵌套,我想请一个听众。我也曾尝试 C:的forEach 代替,但得到了同样的问题。

有关证明我已经简化了code到问题的问题。 有两个按钮,首先第一个界面内:重复,调用成功的一个简单的监听器。第二个按钮是嵌套的UI内:重复元素,应该调用相同的侦听器作为第一个按钮,但监听器永远不会被调用

你能告诉我什么是错呢?

 < D​​IV>
    < UI:重复VAR =testList值=#{testBean.testList}>
        < H:的commandButton值=测试1>
            //调用该侦听器,如果我点击这个按钮
            < F:Ajax事件=点击执行=@这个监听器=#{testBean.testListener}/>
        < / H:的commandButton>
        < UI:重复VAR =nestedList值=#{testList.nestedList}>
            < H:的commandButton值=测试2>
                //监听器就不会被调用,如果我点击这个按钮
                < F:Ajax事件=点击执行=@这个监听器=#{testBean.testListener}/>
            < / H:的commandButton>
        < / UI:重复>
    < / UI:重复>
< / DIV>
 

解决方案

这是一个已知的Mojarra问题涉及到打破&LT状态管理;用户界面:重复> 。特别是这个问题被报告为问题1817 并固定,因为Mojarra 2.1.15。

升级您的Mojarra版本。这是目前的已经在2.1.19。

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>

解决方案

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.

这篇关于JSF监听器不叫嵌套的UI里面:重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆