How to assign unique IDs to the items in <h:dataTable> ?

Hello,

I have such a dataTable where I need to assign aunique id attribute to the <c:chart> component.

There should be one c:chart component on every line and I do not

how to set the ID, this way does not work: id="#{tableData.id}".

It seems that it cannot be a dynamic value.

I am using JSF 1.1 (Tomcat 5.5). The id attribute is obligatory.

<h:dataTable id="table2" value="#{Page2.dataItemList}" var="tableData">

<h:column>

<f:facet name="header">

<h:outputText title="id" />

</f:facet>

<h:outputText value="#{tableData.id}" />

</h:column>

<h:column>

<f:facet name="header">

<h:outputText title="chart" />

</f:facet>

<c:chart id="?" datasource="#{Page2.series}" type="xyline" background="#FFFFCC" title="one of the charts"></c:chart>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText title="name" />

</f:facet>

<h:outputText value="#{tableData.name}" />

</h:column>

</h:dataTable>

[1593 byte] By [honzaa] at [2007-11-27 0:22:05]
# 1
You can't use EL in ID's. You can assign a static value. JSF will take care about the uniqueness. Check the generated HTML afterwards.
BalusCa at 2007-7-11 22:16:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
How simple! I did not try it, I thought it could not work. So for anyone else: just set the id like this: <... id="chart" ...> (just a simple string). Thank you very much.
honzaa at 2007-7-11 22:16:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
By the way, ID's are not required. If you leave them away, JSF will take care about them. However it's considered as good practice to set them manually.
BalusCa at 2007-7-11 22:16:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
This is perhaps an exception. It is "JSF Chart Creator Component", the id attribute is required as it is written here http://jsf-comp.sourceforge.net/components/chartcreator/index.html. But thank you for that tip, anyway.Jan
honzaa at 2007-7-11 22:16:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
That's correct, for some components the ID is indeed required. Like f:subview.
BalusCa at 2007-7-11 22:16:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...