dataTable question
Hi,
I have aMap of Gross Margin <keys> and Price <values> for the
current sales cost.
I want to displayGrossMargin andPrice values using dataTable.
Please Could any one tell me how to display these values using dataTable.
Thanks and regards
Ruther
[327 byte] By [
Ruthera] at [2007-11-27 1:30:53]

# 2
Thanks for reply,<<You can use it for display only though, but then you have to know (and hardcode) the keys before in the JSF code.could you please explain with a small exampleany help is highly appreciatedthanks and regardsRuther>
# 3
MyBeanpublic Map getMap() {
Map map = new HashMap();
map.put("somekey", "somevalue");
return map;
}
JSF<h:outputText value="#{myBean.map.somekey}" />
By the way, you can use List<Map> in a datatable however.
public List getList() {
List list = new ArrayList();
Map map1 = new HashMap();
map1.put("gross", "123");
map1.put("price", "456");
list.add(map1);
Map map2 = new HashMap();
map2.put("gross", "789");
map2.put("price", "012");
list.add(map2);
Map map3 = new HashMap();
map3.put("gross", "345");
map3.put("price", "678");
list.add(map3);
return list;
}
JSF<h:dataTable value="#{myBean.list}" var="map">
<h:column><h:outputText value="#{map.gross}" /></h:column>
<h:column><h:outputText value="#{map.price}" /></h:column>
</h:dataTable>
Using just List<Dto> is more gently though.