• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 67634
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: 25455
178
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).
 
World domination requires a hollowed out volcano with good submarine access. Tiny ads are optional.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic