Click here to Skip to main content
15,880,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am new to JSP and I am facing issue in executing a comparison of hashmap key and an object value. I have an object (Box) which has a string field (size). I have a hashmap also which contains list of Boxes based on size

Map<String, List<Box> boxCatgMap=new HashMap<String, List<Box>>();

  <s:iterator value="boxCatgMap" var="boxCatg">
        <s:set var="boxCatgKey" value="#boxCatg.key"/>
        <s:iterator value="boxes" var="box" status="ind">
           <s:if test="%{#box.size.equals(boxCatgKey)}">
            //some code
           </s:if></s:iterator>
  </s:iterator>

The if condition has some issue because of which it is not getting executed. Can any one please help what am I missing?

What I have tried:

I have been changing the if condition and the tags but it's not working. I am not sure what am i missing.
Posted
Updated 1-Dec-17 6:24am

1 solution

Adding
# in front of boxCatgKey test="%{#box.size.equals(#boxCatgKey)}"
worked.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900