Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:39:57+00:00 2026-06-13T18:39:57+00:00

In my application I want to display a <h:dataTable> with managed bean properties. Currently

  • 0

In my application I want to display a <h:dataTable> with managed bean properties. Currently this table is created from a List<Folder>. Now I want to change the Folder to something more dynamic. That’s because I don’t want to change the Folder class if I decide to add another field later. I would just have to add another entry in the Map<String, Object> instead of introducing a new field in Folder.

So, is it possible to bind a List<Map<String, Object>> to the <h:dataTable>?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:39:58+00:00Added an answer on June 13, 2026 at 6:39 pm

    Is it possible to bind a List of HashMaps to the jsf component h:dataTable?

    That’s only possible if you generate the necessary <h:column> tags with a view build time tag such as JSTL <c:forEach>.

    Here’s a concrete kickoff example, assuming that your environment supports EL 2.2:

    <h:dataTable value="#{bean.listOfMaps}" var="map">
        <c:forEach items="#{bean.listOfMaps[0].keySet().toArray()}" var="key">
            <h:column>
                #{map[key]}
            </h:column> 
        </c:forEach>
    </h:dataTable>
    

    (if your environment doesn’t support EL 2.2, you’d need to provide another getter which returns the map key set as a String[] or List<String>; also keep in mind that a HashMap is by nature unordered, you might want to use LinkedHashMap instead to maintain insertion order)

    When you’re using Mojarra version older than 2.1.18, the disadvantage is that the #{bean} has to be request scoped (not view scoped). Or at least, the <c:forEach items> should refer a request scoped bean. A view scoped bean would otherwise be recreated on every single HTTP request as the <c:forEach> runs during view build time, when the view scope isn’t availabe yet. If you absolutely need a view scoped bean for the <h:dataTable>, then you can always create a separate request scoped bean exclusively for <c:forEach items>. The solution would be to upgrade to Mojarra 2.1.18 or newer. For some background information, see also JSTL in JSF2 Facelets… makes sense?

    JSF component libraries such as PrimeFaces may offer a <x:columns> tag which makes this more easy, such as <p:dataTable> with <p:columns>.

    <p:dataTable value="#{bean.listOfMaps}" var="map">
        <p:columns value="#{bean.listOfMaps[0].keySet().toArray()}" var="key">
            #{map[key]}
        </p:columns>
    </p:dataTable>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display the favicon.ico from websites on my blackberry application. I would
I am creating an application using AppleScript and I want to display a list
On one of our Java application screens, we want to display data loaded from
Hey guys, I have an application that I want to display some data from
In android project/application,I want to display screen2 containing listview when the list item of
i'm having this problem: Suppose you've a blog application and you want to display
I have created a desktop application. On application launch I want to display the
In my application I want to display the date in this format: 21st Aug,2012
I have a simple quiz application and I want display a nice timer /
I am writting an android application and i want to display a webpage inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.