I’m iterating a list of entities in a table. This entity has a list of objects that override the toString method to provide the “name” property of their instance. Let’s call them B objects.
In that table, I want to have a column where all values, as determined by calling their toString method, of object B are joined by a comma. Just like in this snippet:
<rich:column visible="false" label="function">
<f:facet name="header">Function</f:facet>
<h:outputText value="#{fn:join(a.b, ', ')}" />
</rich:column>
Where b is the List of objects of class B. Only problem is jsp1.2 won’t render this:
javax.servlet.ServletException: Cannot convert [] of type class org.hibernate.collection.PersistentBag to class [Ljava.lang.String;
So the question is: is there a nice way of handling this, short of a <c:forEach> to output the list values in a loop?
I’m afraid this is a legacy project using jsp1.2 and seam2.2 and I’m not allowed to upgrade that.
You could create a getter returning a
Stringof your list:You can use the getter in EL: