• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSTL forEach tag

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Can I use forEach tag with HashSet in items attribute? I am using JSF 1.2 and adding forEach JSTL tag to iterate over the items and display each item in a tab. My backing bean gives me a HashSet in the items attribute. I tried to do it, but my richfaces tab label fails but if I use ArrayList in place of HashSet then everything works fine, along with richfaces.
Where am I going wrong? Please help.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to ask JSF questions in the JSF forum. I have moved this post there for you.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Karani Karani wrote:
Where am I going wrong? Please help.



You're going wrong because you're attempting to sequence through a set of non-sequential data, I think. Easiest way around that is to add a property getter to your backing bean that returns the toArray() method called on the HashSet. However be prepared to see things move around unpredictably if you add or remove elements from the underlying HashSet. If that's not acceptable, you need to trade in your vanilla Set object for something that has a predictable ordering (for example, implements the Comparable interface on ts elements).
 
reply
    Bookmark Topic Watch Topic
  • New Topic