【发布时间】:2012-09-10 18:00:56
【问题描述】:
我有以下代码:
<h:dataTable id="dt" value="#{somelist}" var="entry">
<h:column>
#{entry.title}
</h:column>
<h:column>
<h:commandLink id="lnk">
<mycomp:doSomething id="dummy" />
</h:commandLink>
</h:column>
</h:dataTable>
我的复合组件 (mycomp:doSomething) 如下所示:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
</composite:interface>
<composite:implementation >
<script type="text/javascript">
// #{component.parent.clientId}
</script>
</composite:implementation>
</html>
我希望输出 (#{component.parent.clientId}) 类似于以下内容:dt:0:lnk,但它返回的是 dt:0:dummy,即复合组件的客户端 ID。
如何获取真实父标签的ID?
【问题讨论】: