Julien Martin wrote:
Thanks Bruno Aranda,
The only thing is that I want to display a HashMap and not a List (I
should have mentioned that in my email) and I don't want to render it
as a table. This is why I was using jstl. Any other clue?
Julien.
Hi,
Maybe I have a solution, but I didn't try it.
So you want to iterate over map entries and need to get them out of the
map with its key.
Then it would be necessary that a list of the keys is the dataTables
value, so the dataTable can iterate over it.
The map-Object would have to be declared in the faces-config.xml with
the name aMapObject and set as managed-property of the myBean-class.
Example:
<f:view>
<x:dataTable value="#{myBean.mapKeys}" var="key"> //#{myBean['mapKeys']}
would be possible too
<h:column>
//see the ' ' of the 2nd bracket, always needed, when using a String to
get a property
<h:outputText value="#{aMapObject[key]['propertyOfValueObject']}" />
//you can skip the second bracket if the value-object of the map is sth
like date, string, etc
<h:outputText value="#{aMapObject[key]['anotherPropertyOfValueObject']}" />
</h:column>
</x:dataTable>
</f:view>
class MyBean {
private Map myMap;
public List getMapKeys{
return new ArrayList(myMap.keySet());
}
}
You see, JSF-EL is very powerfull, however you have to think about the
tricky ways.
Rgds
Alex