HashTable with dataTable

I have problem with viewing HashTable content by using dataTable ... is there any way to access HashTable content by dataTable ? thanks
[156 byte] By [SarahHamida] at [2007-11-26 15:07:11]
# 1
Hi,what JSF implementation are you using?IL
serafimova_ia at 2007-7-8 8:57:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I used ..

<x:dataTable id="QExamQuestionId" value="#{examinationBean.questionGenerator.newQuestions}"

var="QExamQuestionsTable" rows="10" border="1" align="left">

<h:column>

<h:outputText value="#{QExamQuestionsTable.key}"/>

</h:column>

where new/question is object from the Collection "HashTable" and its key is String Object and its Value is also Object .

and I want to view the content of the value Object .

Note :

I think that the problem that HashTable not display its content by sequence but it display its content depend on the keys .

thanks

SarahHamida at 2007-7-8 8:57:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
h:dataTable only accepts Collections or DataModels which are filled with DTO's or Maps. And not only a pure DTO or Map (Hashtable is a Map, not a Collection). Otherwise you'd better to use a simple panelgrid for this.
BalusCa at 2007-7-8 8:57:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

yes .. sorry I meant Collections API not Collection Interface .

and the problem that access HashTable element Value depends on the key of this element .

<h:dataTable value="#{tableTest.test}" var="hashTable">

<h:column>

<h:outputText value="#{hashTable.name}"/>

</h:column>

</h:dataTable>

where tableTest is bean , test is the object of HashTable and name is the key value of element .

SarahHamida at 2007-7-8 8:57:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Like I said, the h:dataTable "value" valuebinding attribute only accepts an iterated Collection or a DataModel. You can compare the "var" attribute with the Iterator.

Well, in your case a h:panelGrid is sufficient.<h:panelGrid columns="1">

<h:outputText value="#{tableTest.test.name}"/>

</h:panelGrid>

If you really want to use h:dataTable, check this article for an howto: http://balusc.xs4all.nl/srv/dev-jep-dat.html

Of if you really want to use Hashtable objects in a h:dataTable like the way you've coded, put it in a List or DataModel. Here is a basic example with a List of Hashtable obejcts:public List getTest() {

List test = new ArrayList();

Map map1 = new Hashtable();

map1.put("name", "value1");

test.add(map1);

Map map2 = new Hashtable();

map2.put("name", "value2");

test.add(map2);

Map map3 = new Hashtable();

map3.put("name", "value3");

test.add(map3);

return test;

}

which outputs as++

|value1|

++

|value2|

++

|value3|

++

BalusCa at 2007-7-8 8:57:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...