如何在知道jsf组件父级id的情况下获取其id?

如何在知道jsf组件父级id的情况下获取其id?,jsf,managed-bean,Jsf,Managed Bean,我在中有一个。我想获取这个div的id(backingbean中的父元素),我不想直接获取它,但我想通过它的子元素()获取它 请问我怎样才能做到这一点。 在这里您可以找到我的代码示例 <div style="text-align:center; height: 50px; width: 100%; background: wheat; border: 1px #6e5d40 solid; margin-top: 5px;"> &

我在
中有一个
。我想获取这个div的id(backingbean中
的父元素),我不想直接获取它,但我想通过它的子元素()获取它

请问我怎样才能做到这一点。 在这里您可以找到我的代码示例

<div style="text-align:center;    height: 50px; width: 100%; background: wheat; 
                border: 1px #6e5d40 solid; margin-top: 5px;">
        <h:form>
            <ui:repeat var="label1" value="#{backingBean.listOfSearchValue}">
                <span class="filterLabel">#{label1} <h:commandLink class="glyphicon glyphicon-remove"></h:commandLink>
                </span>
            </ui:repeat>
        </h:form>
    </div>

#{label1}

不要只使用普通的HTML
div
,而要使用
h:panelGroup layout=“block”
。然后,只需获取
ui组件的父组件(您案例中的按钮)


另请参阅,以获取有关从bean中查找组件的帮助,尤其是。

将此作为一条注释,并添加了一条注释:在中使用11次投票的答案是使用纯html的解决方案(使用passTour属性)。我只是找不到它是否是namingcontainer…但我不会依赖bean中父级的id来实现“businesslogic”(虽然它可能在控制器中,而不是在真正的服务中,但仍然如此)…耦合变得很紧密