JSF动态找组件id

时间:2022-04-28 05:28:51

有许多有用的函数,可以在JavaScript使用 : 
 rich:clientId('id') -返回短ID形式的客户ID或如果指定的ID的组件没有找到就返回NULL 
 rich:element('id') – 是document.getElementById(#{rich:clientId('id')})的引用。 
 rich:component('id') –是#{rich:clientId('id')}.component的引用 
 rich:findComponent('id') -返回的一个以参数为组件的短ID的UIComponent实例。

 

<h:inputText id="myInput">
<a4j:support event="onkeyup" reRender="outtext"/>
</h:inputText>
<h:outputText id="outtext" value="#{rich:findComponent('myInput').value}" />