在完成commandbutton操作时调用javascript [英] Calling javascript on complete of commandbutton action

查看:62
本文介绍了在完成commandbutton操作时调用javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在完成命令按钮操作后调用JavaScript函数?

How can I call a JavaScript function after completion of command button action?

我正在使用JSF 1.0。

I'm using JSF 1.0.

推荐答案

让JSF条件下呈现所需的脚本。

Just let JSF conditonally render the desired script.

例如

<h:form>
    <h:commandButton value="Submit" action="#{bean.submit}" />
    <h:panelGroup rendered="#{bean.submitted}">
        <script>alert('Form was submitted!');</script>
    </h:panelGroup>
</h:form>

with

private boolean submitted;

public void submit() {
    // ...
    submitted = true;
}

public boolean isSubmitted() {
    return submitted;
}

这篇关于在完成commandbutton操作时调用javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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