Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSTL <c.forEach> and "id" attribute

843842May 12 2004 — edited Sep 29 2005
Hello,

I'm trying to build table with number of columns which is unknown at runtime (value of dataTable is binded to ResultSet which can have variable number of columns during program execution).

This is why I put <h:column> tag nested inside JSTL <c:forEach> tag, like in following code (not actual code, since this is not working, this is just how I immagined it should look):
<h:dataTable value="#{DatabaseBean.data}" var="dbTable">
	<c:forEach var="column" begin="0" end="${DatabaseBean.noOfCols - 1}" varStatus="status">
		<h:column id="???">
.......................
		</h:column>
	</c:forEach>
</h:dataTable>
Unfortunately, due to some constraints (JSF specification 1.0, section 9.2.8.) I must add unique id attribute to every <h:column> tag. So, to enforce this rule, I added id="${column.status.index}", but I find out that using expressions in id attribute is forbidden.

Right now I don't have further idea how to do this, maybe someone can help me ?

I know I am not first with this problem, but I am interested, has anyone find solution or workaround for this, or maybe someone can suggest me some another solution for my problem ?

Thanks, Nedim
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 27 2005
Added on May 12 2004
19 comments
1,751 views