似乎您可以通过表达式语言(EL)隐式对象(
cc和
component)访问当前前缀:
cc.clientId
返回当前 复合 组件的前缀component.clientId
返回任何当前组件的前缀。
例如,在页面中,通过
<myComponent id="foo">
在此组件内部,可以像这样获取客户端ID:
<h:outputText id="bar"> <p>ClientId for the composite component: #{cc.clientId}</p> <p>ClientId for current any component: #{component.clientId}</p></h:outputText>以下内容应打印为:
ClientId for the composite component: fooClientId for current any component: foo:bar
我从博客文章JSF中获得了指针:使用组件标识符(id /
clientId)。它声明这是JSF 2.0的新功能。在此之前,人们必须以编程方式从备用Bean中获取ID。



