• Post Reply Bookmark Topic Watch Topic
  • New Topic

cannot use var in <t:columns>  RSS feed

 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using JSF 1.1 and tomahawk to develop a web app.
I'm trying to create a table dynamically.


In my back bean 'myBean', I have defined a LinkedHashMap<String, Map<Integer, Integer>> variable, where I wanna display its key and value accordingly. But I couldn't get var, listOption, to be used at all. When I try to open the page, its always throwing NullPointerException from #{listOption.key}
Where is wrong with this code? What's the right way to use <t:columns>?
Thanks.
 
Tim Holloway
Bartender
Posts: 18715
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the JavaDocs, I don't see an iterator for that class. When they said "predictable iteration", I think they meant that iterators of the keyset were predictable, not the internal key-value pairs, which aren't directly accessible.

A further problem is that your attempt to get the value wouldn't be correct anyway. If it worked, the more proper EL would be value="#{listOption.value[listOption.key]}"

Actually, more like:


However, that probably won't work either.
 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instead of using map, now I create a class to store those values, and in the back bean I just use an arraylist to store this class object list. Then the problem solved.
thanks for the reply anyway.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!