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

  • SEARCH
  • Home
  • 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 76191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:38:05+00:00 2026-05-10T20:38:05+00:00

I’m using JSF/Facelets, and I’m trying to iterate over some Document objects (custom object)

  • 0

I’m using JSF/Facelets, and I’m trying to iterate over some Document objects (custom object) that I’m keeping in a HashMap. When the page is loaded, I’m getting the error ‘Property ‘name’ not found on type java.util.HashMap$Values’. Here’s what’s in my backing bean:

private Map<String, Document> documents = new HashMap<String, Document>();  public Collection<Document> getDocuments(){     return documents.values(); } 

And in my xhtml page:

<h:dataTable id='documentTable'     value='#{DocumentManager.allDocuments}'     var='doc' rowClasses='list-row-odd, list-row-even'     headerClass='table-header' styleClass='bordered'>      <h:column id='col_name'>          <f:facet name='header'>Name</f:facet>          ${doc.name}     </h:column> </h:dataTable> 

If I change the getDocuments function to the following, it works (meaning the table is displayed without error), but I’m not sure why I need to put the values in the list for the JSF/Facelets page to display properly.

public List<Document> getDocuments(){     List<Document> rtrn = new ArrayList<Document>();     for(Document doc : documents.values())         rtrn.add(doc);     return rtrn; } 

Shouldn’t I be able to iterate over the Collection?

  • 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. 2026-05-10T20:38:05+00:00Added an answer on May 10, 2026 at 8:38 pm

    Well, as it turns out, you can’t just use any kind of collection type with dataTable, and for good reason. From the MyFaces 1.2 Spec, the value attribute must be:

    An EL expression that specifies the data model that backs this table.

    The value referenced by the EL expression can be of any type.

    • A value of type DataModel is used directly.
    • Array-like parameters of type Object[], java.util.List, java.sql.ResultSet or javax.servlet.jsp.jstl.sql.Result are wrapped in a corresponding DataModelthat knows how to iterate over the elements.
    • Other values are wrapped in a DataModel as a single row.

    Note in particular that unordered collections, eg Set are not supported. Therefore if the value expression references such an object then the table will be considered to contain just one element – the collection itself.

    The Collection returned from HashSet.values() is not ordered and, therefore is not supported. If it was, you’d have no idea what order the rows in your table would be output, and refreshes of the page could re-order them randomly. Not good.

    The error you’re getting is, from the last paragraph, it says that the datatable is treating your Collection as the row object, and Collection doesn’t have a ‘name’ property.

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

Sidebar

Ask A Question

Stats

  • Questions 120k
  • Answers 120k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Either one is fine, you're talking about the performance of… May 12, 2026 at 12:08 am
  • Editorial Team
    Editorial Team added an answer Yes, sort of. You can use the -depth option to… May 12, 2026 at 12:08 am
  • Editorial Team
    Editorial Team added an answer I know that .htaccess will at least be easier for… May 12, 2026 at 12:08 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.