File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Help needed with map

P Betta

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.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

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] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Help needed with map
It's not a secret anymore!