Executing a task in JSP using Hashmap lookup

I have a Hashmap and a set of keys. For each key, I want to perform a task depending on whether it is present in the hashmap. Can anyone show how to do this? I am using Struts and JSP in my application

0


source to share


1 answer


This question is old, but have you tried something like this?



for (String key : setOfKeys) {
    if (hm.containsKey(key)) {
        doSomething(hm, key);
    }
}

      

+2


source







All Articles