I want to output a tag with dynamic attributes like:
<foo attr1="val1"
attr2="val1"
attr3="val1">
Contents
</foo>
Where attribute names is unknown in compile time.
It's obviously c:forEach or ui:repeat doesn't work here:
<foo <c:forEach ... /> >
So, is there something like this?
<x:element name='foo'>
<forEach>
<x:attribute name='#{"attr" + index}'>
#{"val" + index}
</x:attribute>
</forEach>
</x:element>
Thanks.
You can do it with f:attribute
(xmlns:f=http://java.sun.com/jsf/core), which would associates an attribute with the nearest parent UIComponent.
See: