【问题标题】:put indicator (like a4j:status) on h:commandButton在 h:commandButton 上放置指示器(如 a4j:status)
【发布时间】:2011-03-31 10:56:49
【问题描述】:

我们使用的是 Richfaces 3.3.3.Final。我们的问题是关于a4j:commandButton 上的navigation 问题。我知道如果我们使用 a4j:commandButton,navigation 将无法正常工作(请访问:http://community.jboss.org/wiki/CommonAjaxRequestsProblems#navigation)。

好的,我知道我必须使用 h:commandButton 才能正常导航。但是现在我需要一个可以与 h:commandButton 一起使用的指示器组件。 <a4j:status> 不适用于 h:commandButton。

有什么建议吗?

谢谢。

【问题讨论】:

    标签: java jsf richfaces


    【解决方案1】:

    <h:commandButton 不适用于a4j:status,因为它不会触发任何 ajax 请求 - 它会触发常规请求。而且用ajax浏览浏览器也没有意义。

    您似乎希望在导航时显示正在进行的工作。这在一般的 http 中是不可能的 - 你要么请求一个新页面并等待它的到来,要么发出一个 ajax 请求。

    但您可以做另一件事 - 使用 <a4j:commandButton oncomplete="redirectBrowser();">,其中 redirectBrowser() 是一个更改当前 url 的 javascript 函数:window.href.location=/desired/target.jsf'。当 ajax 响应返回时,它将被触发。另外,可以禁用onclick按钮,让用户不会点击两次。

    【讨论】:

    • 我知道,但我已经使用 h:commandButton 来正常导航。我的目标是防止系统出现双击问题,并且还给用户一个系统正在处理中的迹象——因为在用户点击 h:commandButton 后系统会计算很多东西
    • @Lurtz - 那么你不应该使用<h:commandButton - 查看我的更新。
    • 如果点击过程需要时间 ~2 分钟,那么 aj4:commandButton 无法正常工作。我们看到并测量它。所以我们不能使用 aj4:commandButton 也 Richfaces 说同样的话 -> community.jboss.org/wiki/CommonAjaxRequestsProblems#navigation
    • @Lurtz - 我没有说要使用 a4j 进行导航。导航是通过javascript完成的。 a4j:commandButton 究竟是如何工作的?会发生什么?
    • 让我们将您的问题分成两部分。 1 - 在 firefox 上:Ajax 指示器始终运行,永不结束 2 - 在 IE8 上:首先你开始 -> Ajax 指示器工作 -> 操作完成但导航不起作用,页面返回到自身而不是导航 -> 如果你按下ajax 按钮在导航工作之后再次出现。
    猜你喜欢
    • 1970-01-01
    • 2012-07-06
    • 1970-01-01
    • 2021-09-24
    • 2016-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多