• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Show HashMap in Datatable. UIColumn with embedded Datatable. Help Needed

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to display a HashMap in a datatable where the values for each key is an ArrayList e.g.


Now I have a Datatable with two columns. First column shows the key and the second column I again have
a datatable to show the ArrayList. So I will have one row with a key and the values again shown in a
datatable. So far I no luck and need some help on how to achieve this. Here is the index2.jsp code I have:



And here is the backing bean Index2.java I have:



Now when I run this application the keys are shown in the respective column but values are coming up as

[AA2, BB2, CC2] in one row rather in a separate Row as I am using a Datatable inside UIColumn to show the values.

Here is what I see in the output:




As above output is not correct as it shows both list values in front of each key rather than what those
keys are tied to. I wanted the following output:



So I can do sorting pagination on the values datatable. But currently the output is not shown correctly. Any help
is really appreciated. My hashmap will be populated dynamically so wants to show the key and values in separate column
but also need to show the values in an embedded datatable as the list can be huge.

Thanks
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this reply is too late but I've just saw your post today and I hope that my reply will help.

You need only to do the following

change
<h:outputText id="out3" value="#{var2.value}"/> in the second dataTable to
<h:outputText id="out3"
value="#{var2.value[collectionBean.dataTable2.rowIndex]}"/>
 
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic