Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to access Collections in JSF  RSS feed

 
Gaurav Ram
Ranch Hand
Posts: 32
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am initializing one Set and List (a collection) values through Spring file with the following code:



When i am accessing List value in JSF its working fine but when i am trying to access Set value it is giving PropertyNotFound exception, i have wriiten the below code in JSF:



Can you please help me to find out my mistake?

Thanks
Gaurav
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I don't recommend starting an ID name with an upper-case letter - that's normally reserved for classnames. However, it shouldn't be causing a problem, it just isn't what I'd do.

Your problem is that a Set is not an ordered collection, hence it cannot be accessed like an array - how would you be able to tell which one is item at index 0? Set's don't remember what sequence their elements were added in.

You need an appropriate data selector, but offhand I can't think of what it would be for a Set member. If you'd defined a dictionary (HashMap), you could access by key like so:

#{AccessListMapSetProperties.testMap['keyvalue']}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!