wood burning stoves*
The moose likes JSP and the fly likes Help needed with map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Help needed with map" Watch "Help needed with map" New topic
Author

Help needed with map

P Betta
Greenhorn

Joined: Aug 03, 2005
Posts: 1
I have 2 maps and I need to loop through the first map and for each key that I get in the first map I need to find if the key exists in the second map. How do I use map.ContainsKey() and map.get() using JSTL? If the key is found in the second map, I need to display the value.

Any insight on this is appreciated.

Thanks in advance.

PB
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60781
    
  65

This actually has less to do with the JSTL than with the EL.

In the EL you cannot call any random method. So a call to a method like containsKey() is not possible. However, you can perform other actions that will yeild similar results.

In the EL, you would do the equivalent of a get() by simply naming the property. So if, for example, you wanted to fetch the mapped value of key 'abc' from a map in scoped variable 'xyz', you would use:



If the key were not hard-coded and was instead in a scoped variable named 'def':



To test whether the key in scoped variable 'def' is defined, you could use:



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help needed with map
 
Similar Threads
A question about read message from resource from java class
Is insertion at a position possible in any flavour of Collection having key value?
Is it possible to insert a new key value pair at a position in a Map?
1.4 Collection question?
HashMap Problem