加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何以编程方式在备份bean中使用ajax-update特定组件

发布时间:2020-12-16 01:34:23 所属栏目:百科 来源:网络整理
导读:是否有一种方法来ajax更新特定组件,例如 h:form在支持豆? 我尝试以下使用 RequestContext#execute() , RequestContext context = RequestContext.getCurrentInstance();context.execute("monitorVehicleForm.update()"); 然而,似乎没有任何效果. RequestCo
是否有一种方法来ajax更新特定组件,例如< h:form>在支持豆?

我尝试以下使用RequestContext#execute(),

RequestContext context = RequestContext.getCurrentInstance();
context.execute("monitorVehicleForm.update()");

然而,似乎没有任何效果.

RequestContext#execute()只执行被传入的任意JavaScript代码作为参数.它不是ajax更新组件的客户端表示.

您需要使用RequestContext#update(),而您只需传递要更新的组件的客户端ID.

context.update("monitorVehicleForm");

这与< p:commandXxx ... update =“monitorVehicleForm”&gt ;.完全相同的效果.这项工作是为您提供的

<h:form id="monitorVehicleForm">

没有任何NamingContainer的父母,因此有一个

<form id="monitorVehicleForm" name="monitorVehicleForm" ...>

在生成的HTML中.

也可以看看:

> How to find out client ID of component for ajax update/render? Cannot find component with expression “foo” referenced from “bar”

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读