Jsf 如何动态引用元素id
我正在尝试使用tomahawk selectOneRadio扩展单选按钮。我的身份证是这样的Jsf 如何动态引用元素id,jsf,richfaces,seam,myfaces,tomahawk,Jsf,Richfaces,Seam,Myfaces,Tomahawk,我正在尝试使用tomahawk selectOneRadio扩展单选按钮。我的身份证是这样的 <rich:dataTable id="carTable" value="#{cars}" var="car"> <rich:column> <s:decorate id="types" template="/layout/display-text.xhtml"> <t:selectOneRadio id="mod
<rich:dataTable id="carTable" value="#{cars}" var="car">
<rich:column>
<s:decorate id="types" template="/layout/display-text.xhtml">
<t:selectOneRadio id="models" value="#{car.model}" layout="spread">
<f:selectItems value="#{models}" />
</t:selectOneRadio>
<h:panelGrid columns="2">
<a:repeat value="#{models}" rowKeyVar="index">
<t:radio for="car:carTable:0:types:models" index="#{index}"></t:radio>
</a:repeat>
</h:panelGrid> -->
</s:decorate>
</rich:column>
</rich:dataTable>
-->
我在检查一个元素后引用了id。但这是行不通的。因为对于每个迭代,单选按钮id都不同。如何在t:radio中引用id
引用的扩展selectOneRadio组件的id。使用标准搜索算法将此值解析为特定组件
我猜a:repeat
是一个NamingContainer
,所以使用“models”
是行不通的。您可以使用t:selectOneRadio
组件的
大概是这样的:
<t:selectOneRadio id="models" value="#{car.model}" layout="spread"
binding="#{requestScope.modelComponent}">
<f:selectItems value="#{models}" />
</t:selectOneRadio>
<h:panelGrid columns="2">
<a:repeat value="#{models}" rowKeyVar="index">
<t:radio for="#{requestScope.modelComponent.clientId}" index="#{index}" />
</a:repeat>
</h:panelGrid>
有关更多详情;使用旧版本;等等。我不做RichFaces/Seam,但不只是for=“models”
工作?如果没有他们,它会起作用的。