aspose file tools*
The moose likes JSP and the fly likes JSLT and apache MultiKey Map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSLT and apache MultiKey Map" Watch "JSLT and apache MultiKey Map" New topic
Author

JSLT and apache MultiKey Map

Carl Jenkins
Ranch Hand

Joined: Feb 19, 2006
Posts: 39
I know in JSTL we can iterate over lists and maps, but is there a way to do the same for MultiKey maps?

Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
You mean if the value of your map is another map or list ?

In that case just use another JSTL for each loop passing in the value of the current iteration of you root map.


JDBCSupport - An easy to use, light-weight JDBC framework -
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

If you are talking about org.apache.commons.collections.map.MultiKeyMap, yes you can iterate over it with c:forEach, because it implements IterableMap, which is a subinterface of Map.


[My Blog]
All roads lead to JavaRanch
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
you need to prepare MultiKeyMap with MultiKey as a key. and to access it in jsp through JSTL/EL

I passed MultiKeyMap and Map(HashMap)<key(String in my case,Object of MultiKey)>

so it would be something like,



Christophe,
Initially I tried the same as I also thought it's same as any other map. But it accepts MultiKey as a key so I went for above approach. I don't know how can I use it as any other map.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

The poster is asking about iterating it. So :

 
 
subject: JSLT and apache MultiKey Map