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
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 .
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|
++