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.
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).
Sometimes the only way things ever got fixed is because people became uncomfortable.
World domination requires a hollowed out volcano with good submarine access. Tiny ads are optional.
Free, earth friendly heat - from the CodeRanch trailboss