>不起作用

发布于 2024-12-15 18:48:59 字数 626 浏览 2 评论 0原文

我的 jsf 2.1 页面上有以下 primefaces 按钮:

    <p:commandButton value="#{msg['button.halt']}" action="#{viewBean.haltTask}" ajax="false">
        <f:setPropertyActionListener target="#{myBean.disabled}" value="false" />
    </p:commandButton>

在应用程序的另一点上,我使用 读取值

    ...
    <f:validateBean disabled="#{myBean.disabled}" />
    ...

现在重点是读取按预期工作,意味着在 myBean 上调用 isDisabled() 方法。 用setPropertyActionListner写法不行。 setter 永远不会被调用。 myBean 的范围为“请求”。 一切都在带有 EL 2.2.x 的 Tomcat 7 上的 Servlet 3 容器中运行。

有人提示可能是什么错误吗?

最好的问候,

弗洛里安

I have the following primefaces button on my jsf 2.1 page:

    <p:commandButton value="#{msg['button.halt']}" action="#{viewBean.haltTask}" ajax="false">
        <f:setPropertyActionListener target="#{myBean.disabled}" value="false" />
    </p:commandButton>

At another point in the application I read the value with

    ...
    <f:validateBean disabled="#{myBean.disabled}" />
    ...

Now the point is the reading works as expected, means the isDisabled() method is called on the myBean.
The writing with the setPropertyActionListner does not work. The setter is never called.
The myBean has Scope "request".
Everything runs in a Servlet 3 container on Tomcat 7 with EL 2.2.x.

Does anybody have a hint what the error might be?

Best regards,

Florian

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

涫野音 2024-12-22 18:48:59

尝试将 myBean 的范围更改为 viewscope,

另请查看此线程中的 BalusC 答案 f:setPropertyActionListener 设置空值而不是预期值

try to change the scope of the myBean to viewscope,

also take a look at BalusC answer in this thread f:setPropertyActionListener sets null value instead of intended value

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文