List of Links in DataTable

I have a dataTable listing customers. I have a column that I want to contain the customer name followed by a list of tags (strings) as commandLinks. Is it possible to do this? I am using NetBeans 5.5 JSF 1.2.

My data object contains

Customer{

long id;

String customerName;

List<Tag> tags;

}

Tag object is

Tag{

String tagName;

}

My JSP contains a datatable with a column such as:

<h:dataTable value="#{bean.customers}" var="row">

<h:column>

<f:facet name="header"><h:outputText value="Customer"></h:outputText></f:facet>

<h:outputText value="#{row.customerName}"/>

<c:foreach items="#{row.tags}" var="tag">

<h:outputText value="#{tag.tagName}" />

</c:foreach>

</h:column>

</h:dataTable>

After experimenting I'm guessing that still doesn't work. So I tried making the JSP:

...

<h:column>

.. header facet ..

<h:panelGroup binding="#{bean.myPG}"/>

</h:column>

...

Then in my bean I have a function

HtmlPanelGroup getMyPG(){

}

In that method I try to grab dataTable.getRowData(), which is a customer. Then pull the list of tags off the customer object, build a list of commandLinks in a panelGroup and return that panelGroup.

I think after debugging that binding= are getting processed once not on a per-row basis. How can I build this list of commandLinks dynamically per row of data?

Will this work? I'm not having much luck with it. Any suggestions?

Nick

[2085 byte] By [nes@students.uwf.edua] at [2007-11-27 1:22:32]
# 1

I can think of two ways:

Way 1:

<t:dataList var="tag" value="#{cust.tags}" layout="unorderedList">

<h:outputText value="#{tag.tagName}"/>

</t:dataList>

Way2:

Problems can be solved with additional layer of indirection:

Write a wrapper class

public class wrapperWrapsTag{}

public class wrapperWrapsCustomer{

public wrapperWrapsTag getMyTags(){}

}

I have not checked my code, so dont shoot me if it is wrong. I think though that this should work

jesefa at 2007-7-12 0:09:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...