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 6840599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:51:49+00:00 2026-05-26T23:51:49+00:00

I have seen a couple other examples on SO discussing some weird workarounds but

  • 0

I have seen a couple other examples on SO discussing some weird workarounds but none seem to work and they were all addressed at versions prior to JSF 2. So, it it possible to simply output the keys of a map? I’ve tried ui:repeat and c:forEach like below with no luck:

<c:forEach items="${myBean.myMap.keySet}" var="var">
   <h:outputText value="#{var}"/>
</c:forEach>
  • 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-05-26T23:51:50+00:00Added an answer on May 26, 2026 at 11:51 pm

    From your code:

    <c:forEach items="${myBean.myMap.keySet}" var="var">
    

    This is not going to work. This requires a getKeySet() method on the Map interface, but there is none.

    If your environment supports EL 2.2 (Servlet 3.0 containers like Tomcat 7, Glassfish 3, etc), then you should invoke the keySet() method directly instead of calling it as a property:

    <c:forEach items="#{myBean.myMap.keySet()}" var="key">
        <h:outputText value="#{key}"/>
    </c:forEach>
    

    Or if your environment doesn’t support EL 2.2 yet, then you should iterate over the map itself directly which gives a Map.Entry instance on every iteration which in turn has a getKey() method, so this should do as well:

    <c:forEach items="#{myBean.myMap}" var="entry">
        <h:outputText value="#{entry.key}"/>
    </c:forEach>
    

    None of above works with <ui:repeat> as it doesn’t support Map nor Set. It supports List and array only. The difference between <c:forEach> and <ui:repeat> is by the way that the <c:forEach> generates multiple JSF components during view build time and that the <ui:repeat> creates a single JSF component which generates its HTML output multiple times during view render time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen couple of sample tables one is with UNIQUE INDEX and other
I've seen a couple similar threads to this question, but none of them really
I have seen a couple of instances now where some legacy code I'm working
I have seen couple of similar problems with solutions, but I couldn't find one
I have seen a couple of question regarding creating datasets in DbUnit here on
Have seen some similar questions: What is the difference between a JavaBean and a
I have seen that in some cases we use following syntax format in c#,
I have seen references to similar issues, but not this exact one. I have
I have seen some docs around suggesting that monodroid could support Entity Manager. Is
I have seen very similar if not same questions on here but my trials

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.